client.close() does not wait for packets to be flushed
See original GitHub issueSteps to reproduce :
- Build a packet and use queueAndFlush to flush it
- Close right after
- See the client not receiving the packet because the connection got closed before.
Pseudocode:
Packet packet = Packet.builder().putInt(100).putInt(200);
packet.queueAndFlush(client);
client.close();
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Client doesn't acknowledge when server closes the connection
close() is called, the closing handshake starts (client sends the FIN packet), and waits until the peer acknowledges (also sends FIN) and closes ......
Read more >close() socket directly after send(): unsafe? - Stack Overflow
It depends upon the implementation, but in general, yes, a close() will flush any data remaining in the buffer before it actually tears...
Read more >WiFi Client - No socket available even with client.flush(), client ...
flush() removes only the current packet characters from the socket. By the time you call client.stop(), the socket may already have characters ...
Read more >This is strictly a violation of the TCP specification
This means the socket is waiting for the application to execute close() . A socket can be in CLOSE_WAIT state indefinitely until the...
Read more >TCP Client/Server Communication | Caché I/O Device Guide
UDP is not connection-based; each transmission of data packets is an independent event. ... Closing the client side first is preferable. If the...
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
@Antideveloppeur Thanks for opening this issue. I’ll look into it very soon to see if I can manage to reproduce it myself, and then fix the issue (if one exists).
I’ll be happy to reopen this issue if you can provide code that reproduces this issue!