Topic Path: Symbol Reference > Classes > TIdTCPConnection Class > TIdTCPConnection Properties > IOHandler Property
ContentsIndexHome
PreviousUpNext
TIdTCPConnection.IOHandler Property

The input / output mechanism for the connection.

property IOHandler: TIdIOHandler;

IOHandler is a TIdIOHandler property that represents the input / output mechanism used for connecting, disconnecting, sending, and receiving on the connection. 

TIdIOHandler, and descendant classes, provide an abstraction that allows use of Socket connections, streams, or any input / output data source where an IOHandler has been written to the interface for the framework. 

IOHandler is used in methods that perform low-level operations for the connection such as connecting, disconnecting, sending, and receiving. The properties, methods, and events in the IOHandler generally belong to the following usage categories: 

 

Configuration 
Destination 
Host 
MaxCapturedLines 
MaxLineLength 
Port 
ReadTimeout 
RecvBufferSize 
SendBufferSize 

 

Connection State 
CheckForDataOnSource 
CheckForDisconnect 
Close 
CloseGracefully 
ClosedGracefully 
Open 
Opened 
ReadLnTimedout 
Readable 

 

Buffers and Buffering 
InputBuffer 
InputBufferAsString 
InputBufferIsEmpty 
InputBufferToStream 
WriteBufferCancel 
WriteBufferClear 
WriteBufferClose 
WriteBufferFlush 
WriteBufferOpen 
WriteBufferThreshhold 
WriteBufferingActive 

 

Read Operations 
AllData 
Capture 
InputLn 
ReadBytes 
ReadCardinal 
ReadChar 
ReadInt64 
ReadInteger 
ReadLn 
ReadLnSplit 
ReadLnWait 
ReadSmallInt 
ReadStream 
ReadString 
ReadStrings 
WaitFor 

 

Write Operations 
Write 
WriteDirect 
WriteLn 
WriteFile 

 

Connection Events 
MaxLineAction 
Intercept 

 

When accessing IOHandler in application code, always cast the IOHandler to the correct descendant class. This allows access to any methods or properties in the descendant that cannot be represented in the ancestor class at runtime. 

Use Socket to access an IOHandler known to descend from the TIdIOHandlerSocket class and allow access to the socket handle and socket options for the binding. 

IOHandler can be assigned using CreateIOHandler and the class reference needed for creating the new IOHandler instance. Use GIOHandlerClassDefault to access a class reference for creating the default IOHandler in Indy. 

An existing TIdIOHandler instance may also be assigned directly to the IOHandler property. When an object instance is assigned to the IOHandler property, the event handler properties in OnWorkBegin, OnWork, and OnWorkEnd are set to the internal event handler methods for the connection object. These event handlers may be re-assigned later in the users application. 

If the new IOHandler is derived from TIdIOHandlerSocket, the value in Socket is updated to reflect the IOHandler instance. In other words, both IOHandler and Socket may contain references to the new IOHandler. 

IOHandler is freed in Destroy when the ManagedIOHandler property contains True, or during the opRemove notification message for the component.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.