First, you should not compare values to boolean literals in an if statement as the statement evaluates boolean values anyway. This is better off written as bSuccess instead of bSuccess == true and !bSuccess instead of bSuccess == false.
Second, you have this structure:
if (bSuccess) { }
if (!bSuccess) { }
These two conditions are mutually exclusive and are better off written like this:
if (bSuccess) { }
else { }
Third, you are modifying a local variable right here, which will go out of scope as soon as you leave the method:
else
{
WRITELOG("Call to socket API 'select' failed inside recv method, error: %d", WSAGetLastError());
bSuccess = false;
break;
}
Right after this, you break out of your loop and return bSuccess;. This could be written to demonstrate you are immediately returning a fail signal like this:
else
{
WRITELOG("Call to socket API 'select' failed inside recv method, error: %d", WSAGetLastError());
return false;
}
FourthThird, you have this snippet:
//decide success or failure
if((iRet > 0) && (FD_ISSET(m_hSocket, &fdWrite)))
{
return true;
}
return false;
This can be written without ifs like this:
return (iRet > 0) && FD_ISSET(m_hSocket, &fdWrite);
The parenthesis around the first statement are not necessary, but might help readability.