General recv() and FD_CLOSE question.
Originally Posted by MSDN-WSAAsyncSelect (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/wsaasyncselect_2.asp)
FD_CLOSE should only be posted after all data is read from a socket, but an application should check for remaining data upon receipt of FD_CLOSE to avoid any possibility of losing data.
Be aware that the application will only receive an FD_CLOSE message to indicate closure of a virtual circuit, and only when all the received data has been read if this is a graceful close. It will not receive an FD_READ message to indicate this condition.
Does the last part of this quote mean, that while receiving data upon FD_READ messages the connection could be closed but I wouldn't receive any more FD_READ messages since the connection has been closed. Since I don't receive any FD_READ messages I don't execute recv() and there is still data to be read on the socket and therefore I don't get an FD_CLOSE message?
Am I understanding this statement correctly?
In a simplified form my question is the following: When properly handling the FD_CLOSE message, is it necessary to take any action if recv() returns 0? Or will I on some point receive a FD_CLOSE message after recv() has returned 0?
Thanks,
-Rune

