   I'm Getting a "recv" Return Value of -1 With No Error Code?
  Hello, I'm a bit confused, for some odd reason when I send a packet of data to my server the recv function acts like it's revived the data and continues, but really the return value of bytes received is -1 and I'm getting nothing out of the recv to my variable too populate with data. Now doesn't that mean a error just happened when I get a -1 from recv? I would think and use the WSAGetLastError function to get the error code, but it just returns 0! So it's kinda no help... Can someone tell me the possibility of what is going wrong? It kinda doesn't make sense to me... If I am able to connect from the client side with no errors from Winsock then I don't see what the problem is.. What I find even more strange is if I debugged my client application and run through the function line by line in debug with VS2008 C++ where I create a connection and send the structure to the server I get no error or problems what so ever..Thank you and I appreciate reading my thread.   
  If you get -1, that's an error. You should then immediately call WSAGetLastError(), because the next WinSock call may clear the error code.If WSAGetLastError() returns 0, then there may be some higher-level error, such as sockets not being initialized, or the file handle (socket) being closed, or something like that. Or maybe just some personal firewall software that's poorly implemented and doesn't set the error codes correctly.;  Even if a socket wasn't initialised, you would still get an error (10038 WSAENOTSOCK or possibly even 10057 WSAENOTCONN).As hplus0603 says though, call WSAGetLastError() immediately after the failing function. I would even go as far as putting error checking after EVERY winsock call. The error codes are relatively easy to understand and can save you hours of headaches.  :)   