Topic Path: Symbol Reference > Classes > TIdIOHandlerStack Class > TIdIOHandlerStack Methods > WriteDirect Method
TIdIOHandlerStack.WriteDirect Method

Performs physical writes to the socket handle for the IOHandler.

procedure WriteDirect(
    var aBuffer: TIdBytes
); override;
Values to be written using the socket-based IOHandler. 

WriteDirect is an overridden procedure used to implement physical writes to the socket-based IOHandler. WriteDirect is called in methods like Write and WriteBufferFlush to move data directly to the socket handle used for network-level access. 

WriteDirect calls the inherited WriteDirect method. 

An EIdNotConnected exception is raised when BindingAllocated contains False, indicating that the socket handle in Binding is not valid. 

WriteDirect determines the size of ABuffer, and uses Binding to write values in ABuffer until all values have been transmitted using the socket handle. An assigned TIdAntiFreeze instance will be used to determine if CPU cycles should be yielded during the write operation. 

WriteDirect updates the value in ClosedGracefully to True when the number of bytes sent on the socket handle in Binding is 0 (zero), and calls CheckForDisconnect to determine if the IOHandler is actively connected to the endpoint for the transfer. 

WriteDirect triggers the OnWork event handler for the number of bytes written to the socket handle in Binding.

Raised with the message RSNotConnected when the socket handle for the IOHandler is no longer allocated. 
Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.