SELECT() question about disconnects

Started by
0 comments, last by PnP Bios 20 years, 6 months ago
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!
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One
Advertisement
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