diff options
-rw-r--r-- | include/enet/enet.h | 4 | ||||
-rw-r--r-- | unix.c | 1 | ||||
-rw-r--r-- | win32.c | 1 |
3 files changed, 5 insertions, 1 deletions
diff --git a/include/enet/enet.h b/include/enet/enet.h index 03a8f29..cfbd01f 100644 --- a/include/enet/enet.h +++ b/include/enet/enet.h @@ -44,7 +44,9 @@ typedef enum enum { ENET_HOST_ANY = 0, /**< specifies the default server host */ - ENET_HOST_BROADCAST = 0xFFFFFFFF /**< specifies a subnet-wide broadcast */ + ENET_HOST_BROADCAST = 0xFFFFFFFF, /**< specifies a subnet-wide broadcast */ + + ENET_PORT_ANY = 0 /**< specifies that a port should be automatically chosen */ }; /** @@ -193,6 +193,7 @@ enet_socket_create (ENetSocketType type, const ENetAddress * address) (struct sockaddr *) & sin, sizeof (struct sockaddr_in)) == -1 || (type == ENET_SOCKET_TYPE_STREAM && + address -> port != ENET_PORT_ANY && listen (newSocket, SOMAXCONN) == -1)) { close (newSocket); @@ -142,6 +142,7 @@ enet_socket_create (ENetSocketType type, const ENetAddress * address) sizeof (struct sockaddr_in)) == SOCKET_ERROR || (type == ENET_SOCKET_TYPE_STREAM && address != NULL && + address -> port != ENET_PORT_ANY && listen (newSocket, SOMAXCONN) == SOCKET_ERROR)) { closesocket (newSocket); |