You have a precedence problem. The line should be of the form
if ((this->ReturnValue = recv(..).)) == -1)
At present you’re comparing the result of recv() with -1 and storing the Boolean result of that comparison into ReturnValue.
So recv() isn’t returning zero at all.
1
solved Recv returning zero incorrectly [closed]