The OnClientConnect
event is triggered by the TServerClientWinSocket
constructor. A TServerClientWinSocket
object is constructed immediately after the OnGetSocket
event is called when a new client socket is accepted by WinSock, and right before the OnAccept
and OnGetThread
events are called. So the only possible way that OnClientConnect
would not be called is if you do not actually have a handler assigned to it.
OnClientError
is called during non-blocking socket failures, and by TCustomWinSocket.SendStream()
, TCustomWinSocket.SendBuf()
, and TCustomWinSocket.ReceiveBuf()
. If you use TWinSocketStream
instead for your I/O, none of those methods are called by it. It raises ESocketError
exceptions on failure instead. If you do not catch those exceptions, the calling TServerClientThread
will simply terminate itself (after passing the exception to the main thread for handling).