mirror of
https://github.com/lsalzman/enet
synced 2024-11-21 14:29:05 -07:00
added support for setting tcp send/receive timeouts
This commit is contained in:
parent
78222dc79e
commit
5018dcf207
3 changed files with 19 additions and 1 deletions
|
@ -50,7 +50,9 @@ typedef enum _ENetSocketOption
|
||||||
ENET_SOCKOPT_BROADCAST = 2,
|
ENET_SOCKOPT_BROADCAST = 2,
|
||||||
ENET_SOCKOPT_RCVBUF = 3,
|
ENET_SOCKOPT_RCVBUF = 3,
|
||||||
ENET_SOCKOPT_SNDBUF = 4,
|
ENET_SOCKOPT_SNDBUF = 4,
|
||||||
ENET_SOCKOPT_REUSEADDR = 5
|
ENET_SOCKOPT_REUSEADDR = 5,
|
||||||
|
ENET_SOCKOPT_RCVTIMEO = 6,
|
||||||
|
ENET_SOCKOPT_SNDTIMEO = 7
|
||||||
} ENetSocketOption;
|
} ENetSocketOption;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|
8
unix.c
8
unix.c
|
@ -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));
|
result = setsockopt (socket, SOL_SOCKET, SO_SNDBUF, (char *) & value, sizeof (int));
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
8
win32.c
8
win32.c
|
@ -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));
|
result = setsockopt (socket, SOL_SOCKET, SO_SNDBUF, (char *) & value, sizeof (int));
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue