Archived

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

PnP Bios

SELECT() question about disconnects

Recommended Posts

PnP Bios    494
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   
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