Sending a message then closing program does not flush message.
See original GitHub issueSo, calling NetClient.Disconnect("Message");
and then closing the application by exiting the Main function does not seem to send the disconnect message to the server and instead the connection closes by timing out.
NetClient.FlushSendQueue()
does not seem to do anything just after Disconnect either.
My workaround was
while ((Peer as NetClient)?.ServerConnection != null)
Thread.Sleep(10);
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (11 by maintainers)
Top Results From Across the Web
Using flush() before close() - java
Developer get into a habit of calling flush() after writing something which must be sent. IMHO Using flush() then close() is common when ......
Read more >Solved: Flush Channel Messages - NI Community
Solved: I'm using the Channeled Message Handler (CMH) template for an application. I have one of my parallel While loops (call it "Loop...
Read more >M_FLUSH Message Handling - STREAMS Programming ...
The stream head does not flush the write queue (no messages will be queued there). The stream head turns the message around (sends...
Read more >Documentation: 15: 55.2. Message Flow
The Flush message does not cause any specific output to be generated, but forces the backend to deliver any data pending in its...
Read more >Logging handlers — Python 3.11.4 documentation
Flushes the stream by calling its flush() method. Note that the close() method is inherited from Handler and so does no output, so...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Found out the source of the issue, so what’s happening is, NetServer’s socket is getting cleaned up properly the first time it closes down / kind-of, then the NetClient properly disconnects.
If that same client reconnects to the server, even a new instance of it, the socket doesn’t close. When the server closes for the second time, the client has to timeout.
I think the issue is in the NetClient, and I’ll see if i can fix it for tomorrrow.
note it also doesn’t seem to be happening all of the time.
Lidgren_Test.zip
Here’s the result and the whole project. Tested with
start NetTest.exe --server && start cmd /C "NetTest.exe && pause"