Jump to content
  • Advertisement

Archived

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

PnP Bios

SELECT() question about disconnects

This topic is 5463 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

I am using the select method with winsock for a console RPG. I am wondering how to check if a client has suddenly disconnected. I have a book on network programming, but it is not very good. It focuses mostly on using Async and Completion Port methods. Please help!

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
IIRC, when a client disconnects, the readfds of the select() function will become activated and select() will return a non-zero result. Check through your readfds and you should find which one caused the message using FD_ISSET(). When you try to read from that socket, the number of bytes read will be 0. That tells you that your client has suddenly disconnected. Hope this helps.

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!