Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Hoser

Sockets and SO_KEEPALIVE option (what does it do?)

This topic is 5492 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just a quick question. What does the SO_KEEPALIVE option do when I enable it? They discuss it in the Windows SDK, but don''t give many details... Thanks

Share this post


Link to post
Share on other sites
Advertisement
I use KeepAlive on my server side and setsockopt() it on my listen socket. When I get a connection the connection inherets the sock opts I set for the listen socket. Keep alive then polls, given a frequency when you set the sock opt, the connected socket to see if it is still alive. This can detect things like cable pulls where the client silently disappears without broadcasting his intention to terminate the connection. This can prevent network timeouts on connections as well I think.

RandomTask

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You can shorten the default timeout delay at which point TCP will send a ''ping'' packet to test the existence of the remote connection. The default is around 2 hours; so setting this delay to smaller value (say 15 minutes) allows a better usage of your sockets.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!