I’ve been playing around with TCP_KEEPALIVE.
I set up a very small server test program on one machine.
A client is started on a seperate machine which connect
to the server. After the connection is establish the server
waits for incomming data via select(). The server sets
the keep alive timeout to 3 seconds (for test purposes)
If I unplug the network cable on the client machine, the
server sits there for as long as I was willing to wait.
When I plug the cable back, the select() exited
with an error within 3-10 seconds.
Is this the expected behavior?
Mario Charest <mcharest@clipzinformatic.com> wrote:
I’ve been playing around with TCP_KEEPALIVE.
I set up a very small server test program on one machine.
A client is started on a seperate machine which connect
to the server. After the connection is establish the server
waits for incomming data via select(). The server sets
the keep alive timeout to 3 seconds (for test purposes)
If I unplug the network cable on the client machine, the
server sits there for as long as I was willing to wait.
When I plug the cable back, the select() exited
with an error within 3-10 seconds.
Is this the expected behavior?
No
If you setup everthing correct, the server will “START”
sending probe packets after 3 seconds idle.
Note, it will retry these packets, until a timeout
decision is made. I don’t remember the number but
it’s some where between 7 - 10 Minutes. This is
unchangable.
After the timeout, the socket will be closed, and
select() should error out.
-xtang