in reply to Re: Howto check if TCP connection is alive ?
in thread Howto check if TCP connection is alive ?

Hi,

thanks for response.. Sadly, this is not an option, cause server on the other side doesn't allow me to do that....

I've read something about keep alive or something, but only in connection to C TCP sockets... There must be some other way to check this without sending on tcp or not ?

Thanks in advance,

regards,

Rob.

  • Comment on Re^2: Howto check if TCP connection is alive ?

Replies are listed 'Best First'.
Re^3: Howto check if TCP connection is alive ?
by apl (Monsignor) on Mar 22, 2008 at 15:05 UTC
    You should talk with the person supporting the server, then. The protocol for a reasonable Client and Server using TCP/IP would include heartbeats. (That is, if a Client hasn't received a message from the Server in M milliseconds, send a heartbeart. If the Server hasn't returned a Heartbeat Acknowledgement in N milliseconds, drop the connection and reconnect.)
Re^3: Howto check if TCP connection is alive ?
by ikegami (Patriarch) on Feb 21, 2010 at 01:22 UTC

    No, the server either needs to send you something periodically by design (a heatbeat), or you need to provoke it into sending something (by sending some request, even one for which you don't care about the answer).

    As an example of the latter, my FTP client sends "TYPE I", "PWD" and other useless commands from time to time. None of the following accomplishes anything except to let the server know we are still alive, and conversely, letting us know the server is still alive.

    COMMAND:> TYPE I 200 Type set to I COMMAND:> PWD 257 "/" is current directory. COMMAND:> TYPE A 200 Type set to A COMMAND:> PASV 227 Entering Passive Mode (69,163,167,32,177,6). COMMAND:> LIST STATUS:> Connecting ftp data socket 69.163.167.32:45318... 150 Opening ASCII mode data connection for file list 226 Transfer complete. COMMAND:> TYPE A 200 Type set to A COMMAND:> PWD 257 "/" is current directory. COMMAND:> REST 0 350 Restarting at 0. Send STORE or RETRIEVE to initiate transf +er COMMAND:> TYPE A 200 Type set to A COMMAND:> TYPE I 200 Type set to I