Do you need to closesocket() if the other side has already disconnected or it is unnecessary?
Printable View
Do you need to closesocket() if the other side has already disconnected or it is unnecessary?
if you do not close the socket, the resource may be leaked. it's a good idea to always close a socket when it is no longer in use.
You only have to close the client socket after you send and recv your data.
You also want to follow MSDNs preferred method for shutting down communications.
I would close.
Thank you!