c++ winsock error

hi I have this code

while(true)
{
Zeromemory(buff, 4096)
int bytes = recv(clientSocket, buff, 4096, 0);
if(bytes == 0)
{
cout << "client disconnected" << endl;
break;
}
recv(clientSocket, buf, 4096, 0);
//send part
}

this code never receives anything in the second recv
even another while loop does not help
I only want the server to recive two pairs of co-ords then send two back
Last edited on
How does the client send the data? Is it possible that the first recv(...) has all of the data already?
Well, those kind of errors occur sometimes and it's really important not to have them and detect them before they hurt you. For that you can also try using an app to help you. I tend to use checkamrx for code security and it works great.
So good luck.
Ben.
Topic archived. No new replies allowed.