Hi all:

According to the library, recv() will return a zero if the socket is closed, and a SOCKET_ERROR if the socket meets an error.
But when I closed my socket (at least I think I closed it properly), recv() returned a SOCKET_ERROR other than zero. Wondering why?

Thank you whoever help me in advance.

Hi all:

According to the library, recv() will return a zero if the socket is closed, and a SOCKET_ERROR if the socket meets an error.
But when I closed my socket (at least I think I closed it properly), recv() returned a SOCKET_ERROR other than zero. Wondering why?

Thank you whoever help me in advance.

Now will be a good time to use the GetLastError() function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.