Fixed bug in xplaneConnect.c

Fixed bug in openUDP where sockets could not be reopened in OS X
This commit is contained in:
Chris Teubert
2014-12-01 14:44:06 -08:00
parent 4bfe4fe88d
commit 9ea7011bfb

View File

@@ -89,6 +89,7 @@ struct xpcSocket openUDP(unsigned short port_number, const char *xpIP, unsigned
#if (__APPLE__ || __linux)
struct timeval tv;
int optval = 1;
#endif
// Setup Port
@@ -147,6 +148,10 @@ struct xpcSocket openUDP(unsigned short port_number, const char *xpIP, unsigned
return theSocket;
}
// Options
setsockopt(theSocket.sock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval));
setsockopt(theSocket.sock, SOL_SOCKET, SO_REUSEPORT, &optval, sizeof(optval));
//Bind
if ( bind(theSocket.sock, (struct sockaddr *) &server, sizeof(server)) == -1)
{