Topic Path: Symbol Reference > Classes > TIdTCPConnection Class > TIdTCPConnection Methods > Disconnect Method > Disconnect Method ()
TIdTCPConnection.Disconnect Method ()

Disconnects the peer connection.

procedure Disconnect; overload;

Disconnect is a procedure used to disconnect from the peer for the connection. 

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 close method in the IOHandler or Socket (when assigned).

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