Based on this question, when you call closesocket()
on a socket that recv()
is already using, then an RST
packet will be sent to the other side instead of performing a graceful disconnection (4-way handshake).
But I wish to perform a graceful disconnection, so I need to exit recv()
before calling closesocket()
.
Is there a way to do that?