PDA

Click to See Complete Forum and Search --> : Help! Winsock API... The damn FD_CLOSE


Allied
Apr 25th, 2001, 12:42 PM
Is there a way to determine if an asynchronous socket is sending data or not? I got a problem closing socket on my server/client application, the way it's built... Does anyone can give me an example of a graceful disconnect? I know it's something like:
1.Finish sending data.
2.Call shutdown() with the how parameter set to 1.
3.Loop on recv() until it returns 0.
4.Call closesocket().
But how can i tell that my socket is finish sending data? Please help, I'm bored!

Yonatan
Apr 27th, 2001, 06:32 AM
I just use shutdown(socket, SD_BOTH) and then closesocket(socket) :rolleyes:
By the way:

Const SD_BOTH = 3