Archived

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

SELECT() question about disconnects

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