What exactly does SO_KEEPALIVE do?
Answer / chaitanya
The SO_KEEPALIVE option causes a packet (called a 'keepalive probe') to be sent to the remote system if a long time (by default, more than 2 hours) passes with no other data being sent or received. This packet is designed to provoke an ACK response from the peer. This enables detection of a peer which has become unreachable (e.g. powered off or disconnected from the net).
Note that the figure of 2 hours comes from RFC1122, "Requirements for Internet Hosts". The precise value should be configurable, but I've often found this to be difficult. The only implementation I know of that allows the keepalive interval to be set per-connection is SVR4.2.
| Is This Answer Correct ? | 0 Yes | 0 No |
What's the difference between impact sockets and regular sockets?
How can I find the full hostname (FQDN) of the system I am running on?
What is the difference between a socket and a port?
What exactly does SO_KEEPALIVE do?
What is the purpose of socket?
What is the difference between close() and shutdown()?
What is a socket connection?
over the socket? Is there a way to have a dynamic buffer? What does one do when one does not know how much information is coming?
What exactly does SO_REUSEADDR do?
What is LILO?
When should I use UDP instead of TCP?
How often should I re-transmit un-acknowleged messages?