SELECT() question about disconnects
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!
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement