In my game i have some basic network code with sockets, but i have come across a small issue. My understanding of how a program retreives data from a socket is that it will simply sit on a function such as this:
Code: Select all
//get a message sent to the socket
bytes = recv(sck_HL,buffer,1023,0);
until data is received, I have it check immediately after this function by:
Code: Select all
if (bytes == SOCKET_ERROR)
{
printf("ERROR:%d\n",WSAGetLastError());
printf("Connection lost, reconnecting in 5 seconds..\n");
Sleep(5000);
Connect();
}