From 6a6e61b4bd85cb1566a3f0f11896128046fb410d Mon Sep 17 00:00:00 2001 From: eihrul Date: Thu, 31 May 2007 08:04:23 +0000 Subject: [PATCH] *** empty log message *** --- include/enet/enet.h | 4 +++- unix.c | 1 + win32.c | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) 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 */ }; /** diff --git a/unix.c b/unix.c index b0e6ee2..8f157b2 100644 --- a/unix.c +++ b/unix.c @@ -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); diff --git a/win32.c b/win32.c index 5fde10d..9559154 100644 --- a/win32.c +++ b/win32.c @@ -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);