Internet Direct (Indy)
Home
PreviousUpNext
TIdTCPConnection.Disconnect Method (Boolean)

Disconnects the peer connection.

Pascal
procedure Disconnect(
    ANotifyPeer: Boolean
); virtual; overload;
Parameters 
Description 
ANotifyPeer 
Indicates if the peer connection is notified when the connection is closed. 

Disconnect is an overloaded method used to disconnect from the peer for the connection. 

ANotifyPeer indicates if the peer connection is notified when the connection is closed. If the connection is still Connected, Disconnect triggers a hsDisconnecting status notification prior to closing the IOHandler for the connection. If the connection is not Connected, no action is performed. 

When FreeIOHandlerOnDisconnect contains True, the IOHandler for the connection will be freed and FreeIOHandlerOnDisconnect is reset to False. 

If the connection was Connected on entry to the method, Disconnect triggers the OnDisconnected event handler and sends a hsDisconnected status notification for the connection. 

Many descendant classes override the Disconnect method to provide termination commands and response handling required by a specific protocol. 

If you simply need to close a connection, you probably should call the Disconnect method, or the Close method in the IOHandler or Socket (when assigned).

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.