Skip to content

Instantly share code, notes, and snippets.

@RklAlx
Created September 27, 2013 10:50
Show Gist options
  • Save RklAlx/6726891 to your computer and use it in GitHub Desktop.
Save RklAlx/6726891 to your computer and use it in GitHub Desktop.
Change Socket Timeout
bool ChangeSocketTimeout(int nHeartBeat) // nHeartBeat - value in milliseconds
{
if(setsockopt(m_Socket, SOL_SOCKET, SO_RCVTIMEO, (const char *) &nHeartBeat, sizeof(nHeartBeat)) == SOCKET_ERROR)
{
printf("Error: %d\n", WSAGetLastError());
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment