netcode: Windows: Connecting to server is delayed if some previous clients do not shutdown by the right way

Hi,

I run the example (client.c & server.c) and found an issue about the cleanup of previous client sessions.

I modified client.c by commenting the line number 97: signal( SIGINT, interrupt_handler) to make client cannot cleanup, After that, I built both client & server on Windows, then run the server.

I opened another console to execute client. I repeated opening client and pressing ctrl + C to terminate it. After 3 - 4 times of doing like that, the client connected to server after a bit delayed.

It seems that recvfrom in (netcode.c:836) emits a lot of WASECONNRESET

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 25 (25 by maintainers)

Most upvoted comments

Thanks for your advice. I have checked the test case and the issue has gone.

Following this logic, I think I know what it is:

        if ( error == WSAEWOULDBLOCK || error == WSAECONNRESET )
            return 0;

The WSACONNRESET is stopping packets from being received, and it’s windows specific… should be able to fix, then you can verify.

I’m going to extend the logs, and try to repro over here

I confirm that this issue still happens.

  1. I run server on the first PC (Windows)
  2. I run the client 1 on a Macbook, and I repeatly start & stop the client 1.
  3. I run the client 2 on a Mac Mini and the connection to server is delayed. Sometimes, client cannot connect to server:
client started on port 52916
client id is 116b51e88fa7df47
client connecting to server 192.168.137.1:40000 [1/1]
client connect failed. connection request timed out
client disconnected