*I don't see anywere in your code logging of the ErrCode argument in the TWSocket events! So it is not sure where you get the error 5*
procedure TForm3.SocketSessionClosed(Sender: TObject; ErrCode: Word); begin {this is Socket = TWSocket} memo1.lines.add('Proxy Disconnected from Server!'); memo1.lines.add( Format('Error %d on SocketSessionClosed', [GetLastError]) ); ClientConnected:= False; end; only here i got error : "Error 5 on SocketSessionClosed" Only this socket closes. LocalClient (TWSocketClient) is still connected to server (TWServerSocket) * I see you have a procedure ServerDataAvailable. Is this handler assigned to the OnDataAvailable of TWSocketServer? If so this is wrong. The serversocket will not receive data. LocalClient is assigned in Server.OnClientConnect. That is good if you use only 1 connection simultanously but if a second connection is etablished you loose the original reference to it.* well.. i still only lierning delphi and this was only way that i can figure out to get all this work dont have an idea how to do this in other way.. *I already asked this, but again: witch socket does the close? And as additional question, when does it close (when sending, receiving etc)?* Closes only Socket (TWsocket) LocalClient Socket (TWSocketClient) is still connected to Server (TWsocketServer) its closes on Socket.Receive in packet log i see: Proxy Read from server -1 bytes <--this is socket.Receive (TWsocket) in error log i see: Error 5 on SocketSessionClosed <-this is socket (TWsocket) PS. sory for my poor English. PSS. Thanks for your time -- 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