Jump to content
  • Advertisement


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


Graceful disconnection.

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

Lets say the server wants to disconnect gracefully and there is no pending data to be received by the client. In the non-blocking client:
FD_ZERO(&fdRdSet);		//empty read set
FD_SET(iSocket, &fdRdSet);	//add socket to read set

select(0, &fdRdSet, NULL, NULL, &tTimeout);

//if socket is readable
if (FD_ISSET(iSocket, &fdRdSet))
	unsigned long iBytesPending;
	ioctlsocket(iSocket, FIONREAD, &iBytesPending);
An iBytesPending value of zero should indicate a graceful disconnection by the server, correct? - CheeseMonger

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!