Advertisement

Aaagh! Game dies when one player leaves.

Started by April 25, 2004 12:41 AM
1 comment, last by mtemple 20 years, 9 months ago
Gents, I have a Winsock socket using UDP and overlapped I/O. In a game with more than two players, I need to allow for one player to quit or be eliminated, and for the remaining players to be able to continue playing. Right now, when this happens, the receive buffers for the remaining players all shut down with a WSAECONNRESET error, and the game is dead. Is there any way to keep the exiting player from shutting the connection down when he leaves? I have tried commenting out all of the calls to closesocket() and WSACleanup(), just to see if I can get a case where the connection will not shut down, but to no avail. I have tried calling shutdown() with every possible setting, and I have messed mecilessly with all of the linger settings. If I can''t keep the connection from shutting down, how can I allow the remaining players to keep on playing? The only thing that preserves the connection is if the exiting player is actually physically disconnected before he can exit the game (ie. I walk over and unplug his network cable). How do I approximate this behavior in the code? How is Winsock sending the message to the other players using this connection, that it has been shut down by the exiting player? It does not seem to be done with closesocket() or WSACleanup(), since commenting these out does not seem to help! I fear I may have some fundamental misunderstanding of the process here! Thanks, Mark Temple Enemy Technology "We have found the enemy, and he is us!"
Mark TempleEnemy Technology"We have found the enemy, and he is us!"
If you mean that your server receives a WSAECONNRESET as soon as one client disconnects, then you can check this article.

What''s interesting is that it''s supposed to be a Win2K bug but i have WinXP and it exhibits the same behavior. I inserted the fix in my code and now i no longer receive WSAECONNRESET when a client disconnects.

Y.
Advertisement
Wow!

Did you have to insert a special case only for Win2000? I''m going to give this a try and I just wondered if I would need to have my code skip this fix if the user is not using Win2000. Does the fix really only apply to the machine on the receiving end (server)? My application is really peer-to-peer at the point I see this problem, but the circumstances of the problem appear to be what I am seeing. I''m going to give this a try.
Thanks for the information. I was really going crazy on this one!


Mark Temple
Enemy Technology

"We have found the enemy, and he is us!"
Mark TempleEnemy Technology"We have found the enemy, and he is us!"

This topic is closed to new replies.

Advertisement