What exactly does SO_KEEPALIVE do?



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

Post New Answer

More Unix Socket Programming Interview Questions

What does af mean in sockets?

0 Answers  


What's the difference between impact sockets and regular sockets?

0 Answers  


How do I properly close a socket?

1 Answers  


Why do we need sockets?

0 Answers  


How would I put my socket in non-blocking mode?

1 Answers  






How to find other end of unix socket connection?

0 Answers  


Is a socket a file?

0 Answers  


How can I tell when a socket is closed on the other end?

0 Answers  


What is socket programming in java?

0 Answers  


What is active unix domain sockets?

0 Answers  


How come select says there is data, but read returns zero?

1 Answers  


Why does the sockets buffer fill up sooner than expected?

0 Answers  


Categories