SDL_net icon indicating copy to clipboard operation
SDL_net copied to clipboard

SDLNet_GetStreamSocketPendingWrites doesn't work as expected

Open captain0xff opened this issue 11 months ago • 0 comments

I made a basic echo server with stream sockets. I made it such that when the user types "quit" both the server and the client should clean-up and close. Now, the issue is that if I call SDLNet_DestroyStreamSocket after sending the "quit" message the server never receives it. Even if I guard SDLNet_DestroyStreamSocket with SDLNet_GetStreamSocketPendingWrites. I also tried using SDLNet_WaitUntilStreamSocketDrained but still the "quit" message never gets sent. But everything works as expected if I put SDL_Delay(100) before destroying the socket. So, my guess is SDLNet_GetStreamSocketPendingWrites doesn't work properly if I understood it's usage correctly.

captain0xff avatar Mar 08 '24 17:03 captain0xff