Re: [twsocket] OnSessionClosed

2007-02-14 Thread Kochendoerfer, Michael
Markus,

why not implementing some kind of NOOP over the protocol? Means that your 
client's sending some special small data packets over the line which the server 
simply drops, only if transfer is idle and possibly timer based?

Michael

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED]
 Behalf Of [EMAIL PROTECTED]
 Sent: Wednesday, February 14, 2007 3:38 PM
 To: twsocket@elists.org
 Subject: [twsocket] OnSessionClosed
 
 
 Hello,
 
 strange problem here:
 
 - two PCs connected via normal LAN
 - one runs my server app (simple TWSocket since the server 
 only has to handle one connection)
 - the other one runs my client app (twsocket as well)
 - the connection is a TCP connection
 
 Normal communication is fine. I've assigned OnSessionClosed 
 on both server and client side.
 If I plug out the cable the server side detects the 
 OnSessionClosed, but not the client side!
 
 This also happens with the included demo programs Client5 and 
 TCPSvr. The server will recognize 
 the lost connection but not the client. Since I'd like to 
 reestablish that connection if there 
 hasn't been a request of my client program to close the 
 connection (I've implemented something 
 for that in my protocol) I need to know on the client side 
 when the connection is lost!
 
 What's wrong here?
 
 Greetings
 
 Markus
 
 
 ebm-papst St. Georgen GmbH  Co. KG 
 Kommanditgesellschaft Sitz St. Georgen 
 Amtsgericht Freiburg HRA 601094 
 Persoenlich haftende Gesellschafterin: 
 Papst-Motoren GmbH, Sitz St. Georgen 
 Amtsgericht Freiburg HRB 600163
 Geschaeftsfuehrer: Dr. Gerhard Lahm, Thomas Wagner 
 
 
 -- 
 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
 
-- 
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


Re: [twsocket] OnSessionClosed

2007-02-14 Thread Wilfried Mestdagh
Hello Markus,

This is how TCP works. OnSessionClosed is fired when the other end say
Goodbye, or when you try to send something and the other end is not
their anymore. There is no traffic if there is no data send, so TCP
layer cannot know if for example cable is plugged out.

So you have to do something lik Michael proposed. Implement keep alive
packets in your protocol if you need to know.

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

-- 
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


Re: [twsocket] OnSessionClosed not always triggered

2006-03-19 Thread Wilfried Mestdagh
Hi Dod,

Did some additional research. If you wants to use TWSocketClient instead
of TWSocket to initiate a connection, then you have to set
FSessionClosedFlag := False; in the OnSessionClosed event. If you do not
then OnSessionClosed will not trigger a second time.

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Sunday, March 19, 2006, 19:03, Wilfried Mestdagh wrote:

 Hello Dod,

 In  the  SessionClosed  I  start  a  Timer that will send a message 20
 second later to retry a .Connect, but this new try will only produce a
 OnSessionConnected not followed by a SessionClosed, any idea why ?

 I examined the project that demonstrate the problem. The client you use
 is derived from TWSocketClient instead of TWSocket. If you change it to
 TWSocket the connect / closed works every time. TWSocketClient's
 OnSessionClose is normally handled by TWSocketServer, so that's the
 reason your OnSessionClose does not trigger.

 I'm not sure wy it is fired the first time. This make it confusing.

 ---
 Rgds, Wilfried [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 http://www.mestdagh.biz

 Saturday, March 18, 2006, 14:01, Dod wrote:

 Hello,

 I  am  actually  doing  some crash test on my server to handle as many
 situations as possible.

 I have a problem in a failed socket .Connect

 I  create  a  few  sockets to .Connect them to some remote points. The
 .Connect  will excecute and fail because there is nothing listening on
 destination  (this  is  wanted  situation  to  test my auto re-connect
 feature).

 The  failure  to  connect will trigger a OnSessionConnected event with
 Error 10061 followed by a SessionClosed.

 In  the  SessionClosed  I  start  a  Timer that will send a message 20
 second later to retry a .Connect, but this new try will only produce a
 OnSessionConnected not followed by a SessionClosed, any idea why ?

 But may be it is the first OnSessionClosed that should never happend ?

 2006/03/17 18:29:39 ! OutgoingConnectorSessionConnected
 [EMAIL PROTECTED]:5433 (10061 Connection refused)
 2006/03/17 18:29:39 ! OutgoingConnectorSessionClosed
 [EMAIL PROTECTED]:5433 (0 No Error)
 2006/03/17 18:29:39 ! OutgoingConnectorSessionConnected
 [EMAIL PROTECTED]:5434 (10061 Connection refused)
 2006/03/17 18:29:39 ! OutgoingConnectorSessionClosed
 [EMAIL PROTECTED]:5434 (0 No Error)
 2006/03/17 18:29:52 ! OutgoingConnectorSessionConnected
 [EMAIL PROTECTED]:5433 (10061 Connection refused)
 2006/03/17 18:29:53 ! OutgoingConnectorSessionConnected
 [EMAIL PROTECTED]:5434 (10061 Connection refused)



-- 
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


Re: [twsocket] OnSessionClosed not always triggered

2006-03-19 Thread Dod
Hello Wilfried,

Yes,  I  came  to  same conclusion too when you told me it worked fine
with  TWSocket.  Now  I  simply  set  FSessionClosedFlag:=False before
calling   .Connect   again   and  all  is  fine.  I  also  added  some
FConnectDidError:=ErrCode in OnSessionConnected sowhen
OnSessionClosed  is  called  I test OnSessionClosed's ErrCode and also
FConnectDidError  then if one of them 0 then I set Timer to make new
.Connect some seconds later.

But I am still looking how to add the reverse connected TWSocketClient
into the main TWSocketServer client's list.

Actually  once  reverse'd  TWSocketClient  is  connected I set it same
OnDataAvailable/OnDataSent as other standard TWSocketServer clients as
only connection and disconnection have to be handled differently.

Regards.

WM Did some additional research. If you wants to use TWSocketClient instead
WM of TWSocket to initiate a connection, then you have to set
WM FSessionClosedFlag := False; in the OnSessionClosed event. If you do not
WM then OnSessionClosed will not trigger a second time.

WM ---
WM Rgds, Wilfried [TeamICS]
WM http://www.overbyte.be/eng/overbyte/teamics.html
WM http://www.mestdagh.biz

WM Sunday, March 19, 2006, 19:03, Wilfried Mestdagh wrote:

 Hello Dod,

 In  the  SessionClosed  I  start  a  Timer that will send a message 20
 second later to retry a .Connect, but this new try will only produce a
 OnSessionConnected not followed by a SessionClosed, any idea why ?

 I examined the project that demonstrate the problem. The client you use
 is derived from TWSocketClient instead of TWSocket. If you change it to
 TWSocket the connect / closed works every time. TWSocketClient's
 OnSessionClose is normally handled by TWSocketServer, so that's the
 reason your OnSessionClose does not trigger.

 I'm not sure wy it is fired the first time. This make it confusing.

 ---
 Rgds, Wilfried [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 http://www.mestdagh.biz

 Saturday, March 18, 2006, 14:01, Dod wrote:

 Hello,

 I  am  actually  doing  some crash test on my server to handle as many
 situations as possible.

 I have a problem in a failed socket .Connect

 I  create  a  few  sockets to .Connect them to some remote points. The
 .Connect  will excecute and fail because there is nothing listening on
 destination  (this  is  wanted  situation  to  test my auto re-connect
 feature).

 The  failure  to  connect will trigger a OnSessionConnected event with
 Error 10061 followed by a SessionClosed.

 In  the  SessionClosed  I  start  a  Timer that will send a message 20
 second later to retry a .Connect, but this new try will only produce a
 OnSessionConnected not followed by a SessionClosed, any idea why ?

 But may be it is the first OnSessionClosed that should never happend ?

 2006/03/17 18:29:39 ! OutgoingConnectorSessionConnected
 [EMAIL PROTECTED]:5433 (10061 Connection refused)
 2006/03/17 18:29:39 ! OutgoingConnectorSessionClosed
 [EMAIL PROTECTED]:5433 (0 No Error)
 2006/03/17 18:29:39 ! OutgoingConnectorSessionConnected
 [EMAIL PROTECTED]:5434 (10061 Connection refused)
 2006/03/17 18:29:39 ! OutgoingConnectorSessionClosed
 [EMAIL PROTECTED]:5434 (0 No Error)
 2006/03/17 18:29:52 ! OutgoingConnectorSessionConnected
 [EMAIL PROTECTED]:5433 (10061 Connection refused)
 2006/03/17 18:29:53 ! OutgoingConnectorSessionConnected
 [EMAIL PROTECTED]:5434 (10061 Connection refused)

-- 
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


[twsocket] OnSessionClosed not always triggered

2006-03-18 Thread Dod
Hello,

I  am  actually  doing  some crash test on my server to handle as many
situations as possible.

I have a problem in a failed socket .Connect

I  create  a  few  sockets to .Connect them to some remote points. The
.Connect  will excecute and fail because there is nothing listening on
destination  (this  is  wanted  situation  to  test my auto re-connect
feature).

The  failure  to  connect will trigger a OnSessionConnected event with
Error 10061 followed by a SessionClosed.

In  the  SessionClosed  I  start  a  Timer that will send a message 20
second later to retry a .Connect, but this new try will only produce a
OnSessionConnected not followed by a SessionClosed, any idea why ?

But may be it is the first OnSessionClosed that should never happend ?

2006/03/17 18:29:39 ! OutgoingConnectorSessionConnected [EMAIL PROTECTED]:5433 
(10061 Connection refused)
2006/03/17 18:29:39 ! OutgoingConnectorSessionClosed [EMAIL PROTECTED]:5433 (0 
No Error)
2006/03/17 18:29:39 ! OutgoingConnectorSessionConnected [EMAIL PROTECTED]:5434 
(10061 Connection refused)
2006/03/17 18:29:39 ! OutgoingConnectorSessionClosed [EMAIL PROTECTED]:5434 (0 
No Error)
2006/03/17 18:29:52 ! OutgoingConnectorSessionConnected [EMAIL PROTECTED]:5433 
(10061 Connection refused)
2006/03/17 18:29:53 ! OutgoingConnectorSessionConnected [EMAIL PROTECTED]:5434 
(10061 Connection refused)

-- 
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


Re: [twsocket] OnSessionClosed not always triggered

2006-03-18 Thread Wilfried Mestdagh
Hello Dod,

 In  the  SessionClosed  I  start  a  Timer that will send a message 20
 second later to retry a .Connect,

This is the correct way to do it.

 but this new try will only produce a
 OnSessionConnected not followed by a SessionClosed

Never had that situation. In al my automated programs I rely on
OnSessionClosed which is always called. If you are absolutely sure can
you try to make a simple project to demonstrate the behaviour ?

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Saturday, March 18, 2006, 14:01, Dod wrote:

 Hello,

 I  am  actually  doing  some crash test on my server to handle as many
 situations as possible.

 I have a problem in a failed socket .Connect

 I  create  a  few  sockets to .Connect them to some remote points. The
 .Connect  will excecute and fail because there is nothing listening on
 destination  (this  is  wanted  situation  to  test my auto re-connect
 feature).

 The  failure  to  connect will trigger a OnSessionConnected event with
 Error 10061 followed by a SessionClosed.

 In  the  SessionClosed  I  start  a  Timer that will send a message 20
 second later to retry a .Connect, but this new try will only produce a
 OnSessionConnected not followed by a SessionClosed, any idea why ?

 But may be it is the first OnSessionClosed that should never happend ?

 2006/03/17 18:29:39 ! OutgoingConnectorSessionConnected
 [EMAIL PROTECTED]:5433 (10061 Connection refused)
 2006/03/17 18:29:39 ! OutgoingConnectorSessionClosed
 [EMAIL PROTECTED]:5433 (0 No Error)
 2006/03/17 18:29:39 ! OutgoingConnectorSessionConnected
 [EMAIL PROTECTED]:5434 (10061 Connection refused)
 2006/03/17 18:29:39 ! OutgoingConnectorSessionClosed
 [EMAIL PROTECTED]:5434 (0 No Error)
 2006/03/17 18:29:52 ! OutgoingConnectorSessionConnected
 [EMAIL PROTECTED]:5433 (10061 Connection refused)
 2006/03/17 18:29:53 ! OutgoingConnectorSessionConnected
 [EMAIL PROTECTED]:5434 (10061 Connection refused)


-- 
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