Menu

#32 Bug for GetError()

v1.0 (example)
open
nobody
None
5
2009-11-19
2009-11-19
Igoogler YE
No

I compiled with Borland c++ 5.0
In nonFatalError() , XmlRpcSocket::getError() return 0.
However in Vs.net, XmlRpcSocket::getError() return EWOULDBLOCK;

I debugged by checking the error code immediately after socket function
int n = recv(fd, readBuf, READ_SIZE-1, 0);
then i could get the right anwser.

I think that's because WSAGetLastError() is not immediately called after socket function.
I checked msdn, that prove my debugging.
"
If a function call's return value indicates that error or other relevant data was returned in the error code, WSAGetLastError should be called immediately. This is necessary because some functions may reset the last extended error code to 0 if they succeed, overwriting the extended error code returned by a previously failed function. To specifically reset the extended error code, use the WSASetLastError function call with the iError parameter set to zero. A getsockopt function when called with an optname parameter of SO_ERROR also resets the extended error code to zero."

Discussion


Log in to post a comment.