Topic Path: Symbol Reference > Classes > TIdSocketHandle Class > TIdSocketHandle Methods > CloseSocket Method
TIdSocketHandle.CloseSocket Method

Closes the connection and destroys the socket handle.

procedure CloseSocket; virtual;

CloseSocket is a virtual procedure used to close the socket connection, and to reset the handle for the socket descriptor. 

When HandleAllocated indicates the socket handle is valid, CloseSocket will reset both the Handle and the HandleAllocated flag by calling Disconnect on the global protocol stack. CloseSocket also sets Handle to Id_INVALID_SOCKET to prevent subsequent access using the now invalid socket descriptor. Access to the socket handle and the allocated flag in the method is a thread-safe operation; they are protected using an internal TIdCriticalSection instance. 

TIdSocketHandle.HandleAllocated, TIdSocketHandle.Handle, GStack, TIdCriticalSection, Id_INVALID_SOCKET 

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