[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: failure detection of tcp connection with LuaSocket ?
- From: Louis Mamakos <louie@...>
- Date: Mon, 21 Mar 2011 13:09:44 -0400
>
> It depends... if you're asking this question you probably care
> somewhat about whether the connection is alive. The easiest way by far
> is to have some kind of ping/pong at the application layer instead of
> using TCP keepalives. If the peer has been silent for a certain amount
> of time, send a ping command to them, and disconnect them if a pong is
> not received within a certain amount of time. Most protocols support
> this.
This is an important distinction. The TCP "keepalive" mechanism is
really "make-dead" by provoking a timeout on an otherwise idle connection.
This might not be what you want -- e.g., a transient network failure
can cause your long-lived association to fail when you don't actually
have any data in flight. It also only provokes a response from the
TCP stack at the other end; this tells you nothing about the state
of the application that's using the TCP connection. The application
could be hung or otherwise defective.
If you can enough to want to know if the application at the other end
is there, then you probably need a means to query it directly.
Louis Mamakos