Hello Frank, Strange... I will try to do a test case this weekend for you.
--- Rgds, Wilfried http://www.mestdagh.biz Friday, July 1, 2005, 16:20, Frank Wunderlich wrote: > Wilfried Mestdagh schrieb: >>Hello Frank, >> >> >> >>>the client has the event OnChangeState but the server have nothing like >>>this for the client-connection-lost (not disconnect). >>> >>> >> >>There is no event for a looze connection. If you pull out the network >>cable from the client, then both server and client will stay connected, >>because to disconnect a packet must be send witch is not the case here. >> >>The only way to know is to send something. then immedialty the >>connection will clsoe and OnSessionClosed will fire with a winsock >>error. >> >> >> >>>i tried to set events for new created clients, ive tried to send data to >>>the client and waiting for an error, but noting happens ;< >>> >>> >> >>2 things will happen: >>- Send will raise an exception (did you put it into exception block?) >>- OnSessionClose will fire >>in case of TWSocketServer you best use OnClientDisconnect. >> >> >> > i don't use a exception-block, but without it the error should be also > fired, but i get none. > sending from server to client raises also no error (where should be > fired one (OnDataSend)?). > greets Frank > here some code: > //trying to send some useless stuff to the clients periodically > procedure TForm1.Timer1Timer(Sender: TObject); > var i:integer; > begin > for i:=0 to WSocketServer1.ClientCount-1 do > begin > WSocketServer1.Client[i].SendStr('Blah'+#13#10); > end; > end; > //the client-disconnect (display shows the message in a memo) > procedure TForm1.WSocketServer1ClientDisconnect(Sender: TObject; > Client: TWSocketClient; Error: Word); > begin > if Error<>0 then showmessage('error'); > Display('disconnect:'+client.GetPeerAddr+' '+discon); > end; > The memo will be filled on regular disconnect, but the error is always 0 > also when i pull out the network cable. > the client fires after a short time (5 seconds) the OnChangeState-Event. > Greets Frank -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be