diff options
| author | Dusan Durech <dusan@debian.debian> | 2009-03-01 18:09:11 +0100 |
|---|---|---|
| committer | Dusan Durech <dusan@debian.debian> | 2009-03-01 18:09:11 +0100 |
| commit | b21832e8d922351169ab4d06e7993ed401fe0924 (patch) | |
| tree | 882f8d3deb61ea8a4586a06c9c5cb5f2e8206054 /src/base | |
| parent | 0fe84801e04022b1c92de363ec907fa6dd63bfd2 (diff) | |
API to UDP and TCP has been modified so that they can be used independet from protocols IPv4 and IPv6
Diffstat (limited to 'src/base')
| -rw-r--r-- | src/base/downServer.c | 2 | ||||
| -rw-r--r-- | src/base/net_multiplayer.c | 2 | ||||
| -rw-r--r-- | src/base/server.c | 10 | ||||
| -rw-r--r-- | src/base/udp_server.c | 6 |
4 files changed, 14 insertions, 6 deletions
diff --git a/src/base/downServer.c b/src/base/downServer.c index 3781ad9..46307cb 100644 --- a/src/base/downServer.c +++ b/src/base/downServer.c @@ -127,7 +127,7 @@ static void destroyClient(client_ds_t *client) int initDownServer(char *ip4, int port4) { - sock_server_tcp = bindTcpSocket(ip4, port4, PROTO_TCPv4); + sock_server_tcp = bindTcpSocket(ip4, port4); if( sock_server_tcp == NULL ) { diff --git a/src/base/net_multiplayer.c b/src/base/net_multiplayer.c index f59b3b2..198abe7 100644 --- a/src/base/net_multiplayer.c +++ b/src/base/net_multiplayer.c @@ -71,7 +71,7 @@ int initNetMuliplayer(int type, char *ip, int port, int proto) #ifndef PUBLIC_SERVER case NET_GAME_TYPE_CLIENT: - if (initClient(ip, port, proto) != 0) { + if (initClient(ip, port) != 0) { fprintf(stderr, _("Unable to inicialize network game as client!\n")); netGameType = NET_GAME_TYPE_NONE; return -1; diff --git a/src/base/server.c b/src/base/server.c index 2112927..6471b46 100644 --- a/src/base/server.c +++ b/src/base/server.c @@ -238,13 +238,21 @@ int initServer(char *ip4, int port4, char *ip6, int port6) setServerMaxClients(SERVER_MAX_CLIENTS); setServerTimer(); + //printf("%s %d %s %d\n", ip4, port4, ip6, port6); ret = initUdpServer(ip4, port4, ip6, port6); if (ret == 0) { return -1; } - initDownServer(ip4, port4); + if( ip4 != NULL ) + { + initDownServer(ip4, port4); + } + else if( ip6 != NULL ) + { + initDownServer(ip6, port6); + } return ret; } diff --git a/src/base/udp_server.c b/src/base/udp_server.c index a469a3a..0e211f3 100644 --- a/src/base/udp_server.c +++ b/src/base/udp_server.c @@ -93,7 +93,7 @@ int initUdpServer(char *ip4, int port4, char *ip6, int port6) ret = 0; if (ip4 != NULL) { - sock_server_udp = bindUdpSocket(ip4, port4, PROTO_UDPv4); + sock_server_udp = bindUdpSocket(ip4, port4); if (sock_server_udp != NULL) { ret++; @@ -104,7 +104,7 @@ int initUdpServer(char *ip4, int port4, char *ip6, int port6) } if (ip6 != NULL) { - sock_server_udp_second = bindUdpSocket(ip6, port6, PROTO_UDPv6); + sock_server_udp_second = bindUdpSocket(ip6, port6); if (sock_server_udp_second != NULL) { ret++; @@ -163,7 +163,7 @@ static void eventClientUdpSelect(sock_udp_t * sock_server) assert(sock_server != NULL); - sock_client = newSockUdp(sock_server->proto); + sock_client = newSockUdp(); isCreateNewClient = FALSE; memset(listRecvMsg, 0, STR_SIZE); |