Servertimeout ... i don't get it working
12 answers - 494 bytes -

Hi,
i've asked you a few days before because i want to make my server watch
for loosing connections.
the client has the event ChangeState but the server have nothing like
this for the client-connection-lost (not disconnect).
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 ;<
can anybody give me a delphi-example to show how to doing this?
hope you can help
Greets Frank
No.1 | | 1470 bytes |
| 
Hello Frank,
the client has the event ChangeState 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 SessionClosed 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?)
- SessionClose will fire
in case of TWSocketServer you best use ClientDisconnect.
Rgds, Wilfried
http://www.mestdagh.biz
Thursday, June 30, 2005, 23:04, Frank Wunderlich wrote:
Hi,
i've asked you a few days before because i want to make my server watch
for loosing connections.
the client has the event ChangeState but the server have nothing like
this for the client-connection-lost (not disconnect).
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 ;<
can anybody give me a delphi-example to show how to doing this?
hope you can help
Greets Frank
No.2 | | 2285 bytes |
| 
Wilfried Mestdagh schrieb:
>Hello Frank,
>
>
>>the client has the event ChangeState 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 SessionClosed 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?)
>- SessionClose will fire
>in case of TWSocketServer you best use ClientDisconnect.
>
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 (DataSend)?).
greets Frank
here some code:
//trying to send some useless stuff to the clients periodically
procedure TForm1.Timer1Timer(Sender: T);
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 (Sender: T;
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 ChangeState-Event.
Greets Frank
No.3 | | 2609 bytes |
| 
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 ChangeState 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 SessionClosed 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?)
SessionClose will fire
>>in case of TWSocketServer you best use ClientDisconnect.
>>
>
>>
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 (DataSend)?).
greets Frank
here some code:
//trying to send some useless stuff to the clients periodically
procedure TForm1.Timer1Timer(Sender: T);
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 (Sender: T;
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 ChangeState-Event.
Greets Frank
No.4 | | 461 bytes |
| 
Hello Frank,
I've just tweaked the orginal Tcpsrv demo a bit. Dropped a timer on it
and let it send something in intervals, then I pluged off the patch
cable and here is the log:
There is now 1 clients connected.
Received from 192.168.178.200: 'who'
Client disconnecting: 192.168.178.200 Duration: 00:01:08Error: 10053
There is now 0 clients connected.
It is exactly working as we told you.
Arno Garrels
No.5 | | 484 bytes |
| 
Arno Garrels wrote:
Hello Frank,
I've just tweaked the orginal Tcpsrv demo a bit. Dropped a timer on it
and let it send something in intervals, then I pluged off the patch
cable and here is the log:
There is now 1 clients connected.
Received from 192.168.178.200: 'who'
Client disconnecting: 192.168.178.200 Duration: 00:01:08Error: 10053
There is now 0 clients connected.
It is exactly working as we told you.
Arno Garrels
No.6 | | 648 bytes |
| 
Hallo Arno,
am Freitag, 1. Juli 2005, 18:52:25 hast du geschrieben:
Arno Garrels wrote:
>Hello Frank,
>
>I've just tweaked the orginal Tcpsrv demo a bit. Dropped a timer on it
>and let it send something in intervals, then I pluged off the patch
>cable and here is the log:
>
>There is now 1 clients connected.
>Received from 192.168.178.200: 'who'
>Client disconnecting: 192.168.178.200 Duration: 00:01:08Error: 10053
>There is now 0 clients connected.
>
>It is exactly working as we told you.
>
>Arno Garrels
No.7 | | 1141 bytes |
| 
Frank Wunderlich wrote:
Hallo Arno,
am Freitag, 1. Juli 2005, 18:52:25 hast du geschrieben:
>Arno Garrels wrote:
Hello Frank,
I've just tweaked the orginal Tcpsrv demo a bit. Dropped a timer on it
and let it send something in intervals, then I pluged off the patch
cable and here is the log:
There is now 1 clients connected.
Received from 192.168.178.200: 'who'
Client disconnecting: 192.168.178.200 Duration: 00:01:08Error: 10053
There is now 0 clients connected.
It is exactly working as we told you.
Arno Garrels
>--
>To unsubscribe or change your settings for TWSocket mailing list
>please goto
>Visit our website at http://www.overbyte.be
where did you generate that log (the line with errorcode). is this the
onclientdisconnect?
Yes, take a look at Tcpsrv demo, I only added "+ 'Error: ' + IntToStr(Error)"
how do you send (the same way i do?)?
Yes, iterating thru the list of clients sending a string.
Arno Garrels
No.8 | | 2468 bytes |
| 
Arno Garrels schrieb:
>Frank Wunderlich wrote:
>
>>Hallo Arno,
>>
>>am Freitag, 1. Juli 2005, 18:52:25 hast du geschrieben:
>>
>
>>
Arno Garrels wrote:
Hello Frank,
I've just tweaked the orginal Tcpsrv demo a bit. Dropped a timer on it
and let it send something in intervals, then I pluged off the patch
cable and here is the log:
There is now 1 clients connected.
Received from 192.168.178.200: 'who'
Client disconnecting: 192.168.178.200 Duration: 00:01:08Error: 10053
There is now 0 clients connected.
It is exactly working as we told you.
Arno Garrels
To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at http://www.overbyte.be
>>where did you generate that log (the line with errorcode). is this the
>>onclientdisconnect?
>
>>
>
>Yes, take a look at Tcpsrv demo, I only added "+ 'Error: ' + IntToStr(Error)"
>
>
>>how do you send (the same way i do?)?
>
>>
>
>Yes, iterating thru the list of clients sending a string.
>
>Arno Garrels
>
it does really not work forhere the changes in the tcpsvr-demo:
procedure TTcpSrvForm.Timer1Timer(Sender: T);
var i:integer;
begin
for i:=0 to WSocketServer1.ClientCount-1 do
begin
WSocketServer1.Client[i].SendStr('Blah'+#13#10);
end;
end;
procedure (
Sender : T;
Client : TWSocketClient;
Error : Word);
begin
with Client as TTcpSrvClient do begin
Display('Client disconnecting: ' + PeerAddr + ' ' +
'Duration: ' + FormatDateTime('hh:nn:ss',
Now - ConnectTime)+' Error: '+IntToStr(Error));
Display('There is now ' +
IntToStr(TWSocketServer(Sender).ClientCount - 1) +
' clients connected.');
end;
end;
the server does not fire the onclientdisconnect in my applicationi
don't know why
what have you done in another way?
Greets frank
No.9 | | 2318 bytes |
| 
Frank Wunderlich wrote:
Arno Garrels schrieb:
>Frank Wunderlich wrote:
>
>
Hallo Arno,
am Freitag, 1. Juli 2005, 18:52:25 hast du geschrieben:
Arno Garrels wrote:
Hello Frank,
I've just tweaked the orginal Tcpsrv demo a bit. Dropped a timer on it
and let it send something in intervals, then I pluged off the patch
cable and here is the log:
There is now 1 clients connected.
Received from 192.168.178.200: 'who'
Client disconnecting: 192.168.178.200 Duration: 00:01:08Error: 10053
There is now 0 clients connected.
It is exactly working as we told you.
Arno Garrels
--
To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at http://www.overbyte.be
where did you generate that log (the line with errorcode). is this the
onclientdisconnect?
>
>Yes, take a look at Tcpsrv demo, I only added "+ 'Error: ' +
>IntToStr(Error)"
>
>
>
how do you send (the same way i do?)?
>
>Yes, iterating thru the list of clients sending a string.
>
>Arno Garrels
>
>
>
it does really not work forhere the changes in the tcpsvr-demo:
procedure TTcpSrvForm.Timer1Timer(Sender: T);
var i:integer;
begin
for i:=0 to WSocketServer1.ClientCount-1 do
begin
WSocketServer1.Client[i].SendStr('Blah'+#13#10);
end;
end;
procedure (
Sender : T;
Client : TWSocketClient;
Error : Word);
begin
with Client as TTcpSrvClient do begin
Display('Client disconnecting: ' + PeerAddr + ' ' +
'Duration: ' + FormatDateTime('hh:nn:ss',
Now - ConnectTime)+' Error: '+IntToStr(Error));
Display('There is now ' +
IntToStr(TWSocketServer(Sender).ClientCount - 1) +
' clients connected.');
end;
end;
the server does not fire the onclientdisconnect in my applicationi
don't know why
what have you done in another way?
No difference - very strange, my conf. was W2k-SP4, ethernet 100Mbit.
Arno Garrels
No.10 | | 2900 bytes |
| 
Arno Garrels schrieb:
>Frank Wunderlich wrote:
>
>>Arno Garrels schrieb:
>>
>
>>
Frank Wunderlich wrote:
Hallo Arno,
am Freitag, 1. Juli 2005, 18:52:25 hast du geschrieben:
Arno Garrels wrote:
Hello Frank,
I've just tweaked the orginal Tcpsrv demo a bit. Dropped a timer on it
and let it send something in intervals, then I pluged off the patch
cable and here is the log:
There is now 1 clients connected.
Received from 192.168.178.200: 'who'
Client disconnecting: 192.168.178.200 Duration: 00:01:08Error: 10053
There is now 0 clients connected.
It is exactly working as we told you.
Arno Garrels
To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at http://www.overbyte.be
where did you generate that log (the line with errorcode). is this the
onclientdisconnect?
Yes, take a look at Tcpsrv demo, I only added "+ 'Error: ' +
IntToStr(Error)"
how do you send (the same way i do?)?
Yes, iterating thru the list of clients sending a string.
Arno Garrels
>>it does really not work forhere the changes in the tcpsvr-demo:
>>
>>procedure TTcpSrvForm.Timer1Timer(Sender: T);
>>var i:integer;
>>begin
>for i:=0 to WSocketServer1.ClientCount-1 do
>begin
>WSocketServer1.Client[i].SendStr('Blah'+#13#10);
>end;
>>end;
>>
>>procedure (
>Sender : T;
>Client : TWSocketClient;
>Error : Word);
>>begin
>with Client as TTcpSrvClient do begin
>Display('Client disconnecting: ' + PeerAddr + ' ' +
>'Duration: ' + FormatDateTime('hh:nn:ss',
>Now - ConnectTime)+' Error: '+IntToStr(Error));
>Display('There is now ' +
>IntToStr(TWSocketServer(Sender).ClientCount - 1) +
>' clients connected.');
>end;
>>end;
>>
>>the server does not fire the onclientdisconnect in my applicationi
>>don't know why
>>what have you done in another way?
>
>>
>
>No difference - very strange, my conf. was W2k-SP4, ethernet 100Mbit.
>
>Arno Garrels
i have win xp (SP2) on client and server, ethernet 100MBit/s, ICS
TWSocket 4.45 TWSocketServer 1.07, TCPSvr-Demo 1.04.
i can send you the full source-code if you have another demo-version.
Greets frank
No.11 | | 180 bytes |
| 
Frank Wunderlich wrote:
i can send you the full source-code if you have another demo-version.
K send me the zipped TcpSvr.exe.
Arno Garrels
Greets frank
No.12 | | 602 bytes |
| 
>No difference - very strange, my conf. was W2k-SP4, ethernet 100Mbit.
>
>Arno Garrels
>
>
>
i have win xp (SP2) on client and server, ethernet 100MBit/s, ICS
TWSocket 4.45 TWSocketServer 1.07, TCPSvr-Demo 1.04.
i can send you the full source-code if you have another demo-version.
I tested your EXE, it worked perfectly on my system.
At next I would try to re-install the TCP/IP stack on the system in question,
does that change anything?
BTW: You are working with an outdated ICS version.
Arno Garrels