Answer Posted / 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 |
Post New Answer View All Answers
What's the difference between a socket and a port?
What is a socket address?
What are the types of sockets?
Can a socket have multiple ports?
How many socket connections can a server handle?
Are sockets files?
What is difference between socket and websocket?
What are the pros/cons of select(), non-blocking I/O and SIGIO?
Can a single socket port be used for multiple applications?
What is a socket api?
Is there any advantage to handling the signal, rather than just ignoring it and checking for the EPIPE error? Are there any useful parameters passed to the signal catching function?
Why does the sockets buffer fill up sooner than expected?
What is a socket file?
What is socket programming in java?
What is a socket connection?