recvfrom returns SOCKET_ERROR but WSAGetLastError returns 0
C / C++ / MFC
1
Posts
1
Posters
0
Views
1
Watching
-
Hi, I have this little part of code:
char* echoReply = new char[1024]; int nRet; int nAddrLen = sizeof(struct sockaddr_in); sockaddr_in lpsaFrom; lpsaFrom.sin_family = AF_INET; lpsaFrom.sin_port = 0; // Recieve the echo reply nRet = recvfrom(s, (char*) &echoReply, 1024, 0, (sockaddr*) &lpsaFrom, &nAddrLen); if (nRet == SOCKET_ERROR) int error = WSAGetLastError();
nRet (the return value of recvfrom) is 0xffffffff (SOCKET_ERROR) but WSAGetLastError returns 0 (no error). how can this be? I don't think this is possible. can anybody help me, please? Thx CND