Hello: I'm still getting familiar with the low level functionality of the TWSocket underlying component, so please excuse my question if it sounds trivial. I'm trying to set up a simple tcp listener that accepts a single client connection and communicates with it. I am basing it off the TWSchat demo as it does pretty much what I need: - to accept a client - to keep listening while connected - to respond with a message when other clients connect
The way I'm doing it (as per the demo) is to give the accepted socket handle to the client object if it is free in the OnSessionAvailable event: Procedure TSrvApp.Srv_ClientAvailable(Sender: TObject; Error: Word); Begin If (FCliSocket.State = wsConnected) Then Begin // we're busy, dismiss the connection FBusySocket.HSocket := FSrvSocket.Accept; FBusySocket.SendStr('Server busy, try again later.'+ #13#10); FBusySocket.CloseDelayed; End Else Begin // Accept the connection FCliSocket.HSocket := FSrvSocket.Accept; FCliSocket.LineMode := True; End; End; I've noticed that when this is done, the OnSessionConnected event of the client is never triggered. I thought this was unusual as I thought that FD_CONNECT (which ultimately triggers the event) comes after FD_ACCEPT. Or am I doing something wrong? -dZ. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be