Internet Direct (Indy)
Home
PreviousUpNext
TIdTCPClientCustom.Connect Method ()

Opens the client connection and sets the IOHandler.

Pascal
procedure Connect; virtual; overload;

Connect is an overloaded procedure used to open the connection using the IOHandler for the client. If the IOHandler is already Connected, an EIdAlreadyConnected is raised. If an IOHandler has not been assigned, a default IOHandler for the class is created with the OnStatus event handler from the custom client. FreeIOHandlerOnDisconnect is set to True to indicate that the IOHandler can be freed in a call to Disconnect

Destination is used to set the endpoint for the IOHandler when it contains a non-blank value. If both the Host and Port number are unspecified after setting Destination, the values in the Host and Port properties are assigned to the IOHandler

The IOHandler is opened, and the OnConnect event for the Intercept in the IOHandler is triggered (when available). The OnStatus and OnConnected event handlers for the custom client are triggered after the IOHandler is opened. 

The IOHandler will be closed if an exception is raised during the connection process. The exception is re-raised prior to exiting from the method. 

Use Disconnect to close the client connection. 

Use ConnectAndGetAll to open a connection, read available data, and close the connection in a single method call.

Exceptions 
Description 
Exception raised when the IOHandler for the connection is already connected to the peer.
 
Raised when the remote Host for the connection contains a blank value.
 
Raised when the remote Port number for the connection contains 0 (zero). 
Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.