Trung Nguyen
2016-05-11 02:52:19 UTC
I'm new with MFC and AsyncSocket. Can someone kindly tell me how to catch socket operations' error (like connect(), send(), or recv()...)? Because when I do this:
int iLen = recv(connectSocket, socketBuffer, sizeToRead , NULL);
if(iLen==SOCKET_ERROR) {
//handle error here
} else {
//do something with the received data
}
It always return error, but when I remove the check, the socket actually received data.
int iLen = recv(connectSocket, socketBuffer, sizeToRead , NULL);
if(iLen==SOCKET_ERROR) {
//handle error here
} else {
//do something with the received data
}
It always return error, but when I remove the check, the socket actually received data.