Merge pull request #20 from jwatkins42/master

Removed duplicate socket initialization and clarified socket timeout.
This commit is contained in:
Christopher Teubert
2014-12-03 10:24:56 -08:00

View File

@@ -140,8 +140,6 @@ struct xpcSocket openUDP(unsigned short port_number, const char *xpIP, unsigned
}
#elif (__APPLE__ || __linux)
// Create a SOCKET
theSocket.sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if ((theSocket.sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
{
perror((char*) "ERROR: openUDP- ");
@@ -161,10 +159,10 @@ struct xpcSocket openUDP(unsigned short port_number, const char *xpIP, unsigned
#endif
//Set Timout
int msTimeOut = 500;
int usTimeOut = 500;
#ifdef _WIN32
DWORD msTimeOutWin = 1;
DWORD msTimeOutWin = 1; // Minimum socket timeout in Windows is 1ms
setsockopt(theSocket.sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&msTimeOutWin, sizeof(msTimeOutWin));
#else
tv.tv_sec = 0; /* Sec Timeout */