diff options
author | eihrul <eihrul> | 2012-02-18 10:31:56 +0000 |
---|---|---|
committer | eihrul <eihrul> | 2012-02-18 10:31:56 +0000 |
commit | 5018dcf2071de5b483d3f452730ee44b0a3248a5 (patch) | |
tree | 729d62f46ea4739ac097e39fad158896d581fe5a | |
parent | 78222dc79e720686028f59bdc8b29b10dbc18cfa (diff) | |
download | enet-5018dcf2071de5b483d3f452730ee44b0a3248a5.tar.gz enet-5018dcf2071de5b483d3f452730ee44b0a3248a5.zip |
added support for setting tcp send/receive timeouts
-rw-r--r-- | include/enet/enet.h | 4 | ||||
-rw-r--r-- | unix.c | 8 | ||||
-rw-r--r-- | win32.c | 8 |
3 files changed, 19 insertions, 1 deletions
diff --git a/include/enet/enet.h b/include/enet/enet.h index d73655f..14f9382 100644 --- a/include/enet/enet.h +++ b/include/enet/enet.h @@ -50,7 +50,9 @@ typedef enum _ENetSocketOption ENET_SOCKOPT_BROADCAST = 2, ENET_SOCKOPT_RCVBUF = 3, ENET_SOCKOPT_SNDBUF = 4, - ENET_SOCKOPT_REUSEADDR = 5 + ENET_SOCKOPT_REUSEADDR = 5, + ENET_SOCKOPT_RCVTIMEO = 6, + ENET_SOCKOPT_SNDTIMEO = 7 } ENetSocketOption; enum @@ -219,6 +219,14 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value) result = setsockopt (socket, SOL_SOCKET, SO_SNDBUF, (char *) & value, sizeof (int)); break; + case ENET_SOCKOPT_RCVTIMEO: + result = setsockopt (socket, SOL_SOCKET, SO_RCVTIMEO, (char *) & value, sizeof (int)); + break; + + case ENET_SOCKOPT_SNDTIMEO: + result = setsockopt (socket, SOL_SOCKET, SO_SNDTIMEO, (char *) & value, sizeof (int)); + break; + default: break; } @@ -166,6 +166,14 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value) result = setsockopt (socket, SOL_SOCKET, SO_SNDBUF, (char *) & value, sizeof (int)); break; + case ENET_SOCKOPT_RCVTIMEO: + result = setsockopt (socket, SOL_SOCKET, SO_RCVTIMEO, (char *) & value, sizeof (int)); + break; + + case ENET_SOCKOPT_SNDTIMEO: + result = setsockopt (socket, SOL_SOCKET, SO_SNDTIMEO, (char *) & value, sizeof (int)); + break; + default: break; } |