Tcp reconnection

  • Thread starter Thread starter Droopy
  • Start date Start date
D

Droopy

Hi,

I am working on a project where some PCs are sending messages via Tcp
sockets.
When the Tcp connection is down (cable unplugged) I detect it using WMI.
When the connection is back, it does not mean that I can immediately send
data.
My question is : is there any event that I can trigger when I can send data
again ?
If no, what is the best way to handle this (retries, ...) ?

Thanks in advance,

Droopy.
 
Hi,


When the Tcp connection is down (cable unplugged) I detect it using WMI.

You dont need that really, just check if you can connect or not, a
connection may be down because a lot more thing beside you disconnect your
cable, what if it's the router where the cable is disconnecteD?
When the connection is back, it does not mean that I can immediately send
data.

Well, first you need to restablish the connection, the other ends need to be
aware of it too, in a similar way the other end should check for connection
errors

If no, what is the best way to handle this (retries, ...) ?

Yes, retries is the best (if not the only) solution here



cheers,
 
Hi,




You dont need that really, just check if you can connect or not, a
connection may be down because a lot more thing beside you disconnect
your cable, what if it's the router where the cable is disconnecteD?

True, I want to handle all communication errors
Well, first you need to restablish the connection, the other ends need
to be aware of it too, in a similar way the other end should check for
connection errors

The problem is that the other ends does not see there is a problem, at
least before a timeout elapsed, if it does not send data.
Yes, retries is the best (if not the only) solution here

OK I will try this way.
It does not seems trivial at first look !

Thanks a lot for your help.
 
True, I want to handle all communication errors


The problem is that the other ends does not see there is a problem, at
least before a timeout elapsed, if it does not send data.

I need a "keep alive" system.
I know Tcp has it but the default is 2 hours.
I am displaying the status of the connection and I would like to be
notified within a few seconds when the connection is down.
Should I do it by myself (sending a kind of ping message) or can I set
the Tcp keep alive value to a few seconds ?

Thanks in advance for any help.
 
Back
Top