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.

Recommended Answers

All 2 Replies

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.

Thanks Wolf.

Be a part of the DaniWeb community

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