[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: failure detection of tcp connection with LuaSocket ?
- From: Valerio Schiavoni <valerio.schiavoni@...>
- Date: Mon, 21 Mar 2011 15:27:18 +0100
suppose I establish a tcp connection to a server.
Is there some kind of callback mechanism that I can exploit to detect when such connection is no longer usable?
The failures I'd like to detect are in particular the crash of the server.
Ideally, I'd like the client to detect it as soon as possible.
It seems a feature of TCP, keepalive messages, is meant to help in this scenario.
LuaSocket seems to support this option:
"'keepalive': Setting this option to true enables the periodic transmission of messages on a connected socket. Should the connected party fail to respond to these messages, the connection is considered broken and processes using the socket are notified;"
Nevertheless, the 3 parameters that regulate this tcp feature (period, interval, timeout) are not documented: are those supported at all ?
Is this approach the better/most-common way to detect tcp connection failures?