mirror of
https://github.com/lsalzman/enet
synced 2024-11-21 14:29:05 -07:00
added enet_socket_get_option() and ENET_SOCKOPT_ERROR
This commit is contained in:
parent
73ef8d8a96
commit
e123218df3
4 changed files with 32 additions and 1 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
* added enet_socket_get_option() and ENET_SOCKOPT_ERROR
|
||||||
|
* added enet_host_random_seed() platform stub
|
||||||
|
|
||||||
ENet 1.3.8 (June 2, 2013):
|
ENet 1.3.8 (June 2, 2013):
|
||||||
|
|
||||||
* added enet_linked_version() for checking the linked version
|
* added enet_linked_version() for checking the linked version
|
||||||
|
|
|
@ -60,7 +60,8 @@ typedef enum _ENetSocketOption
|
||||||
ENET_SOCKOPT_SNDBUF = 4,
|
ENET_SOCKOPT_SNDBUF = 4,
|
||||||
ENET_SOCKOPT_REUSEADDR = 5,
|
ENET_SOCKOPT_REUSEADDR = 5,
|
||||||
ENET_SOCKOPT_RCVTIMEO = 6,
|
ENET_SOCKOPT_RCVTIMEO = 6,
|
||||||
ENET_SOCKOPT_SNDTIMEO = 7
|
ENET_SOCKOPT_SNDTIMEO = 7,
|
||||||
|
ENET_SOCKOPT_ERROR = 8
|
||||||
} ENetSocketOption;
|
} ENetSocketOption;
|
||||||
|
|
||||||
typedef enum _ENetSocketShutdown
|
typedef enum _ENetSocketShutdown
|
||||||
|
@ -491,6 +492,7 @@ ENET_API int enet_socket_send (ENetSocket, const ENetAddress *, const ENe
|
||||||
ENET_API int enet_socket_receive (ENetSocket, ENetAddress *, ENetBuffer *, size_t);
|
ENET_API int enet_socket_receive (ENetSocket, ENetAddress *, ENetBuffer *, size_t);
|
||||||
ENET_API int enet_socket_wait (ENetSocket, enet_uint32 *, enet_uint32);
|
ENET_API int enet_socket_wait (ENetSocket, enet_uint32 *, enet_uint32);
|
||||||
ENET_API int enet_socket_set_option (ENetSocket, ENetSocketOption, int);
|
ENET_API int enet_socket_set_option (ENetSocket, ENetSocketOption, int);
|
||||||
|
ENET_API int enet_socket_get_option (ENetSocket, ENetSocketOption, int *);
|
||||||
ENET_API int enet_socket_shutdown (ENetSocket, ENetSocketShutdown);
|
ENET_API int enet_socket_shutdown (ENetSocket, ENetSocketShutdown);
|
||||||
ENET_API void enet_socket_destroy (ENetSocket);
|
ENET_API void enet_socket_destroy (ENetSocket);
|
||||||
ENET_API int enet_socketset_select (ENetSocket, ENetSocketSet *, ENetSocketSet *, enet_uint32);
|
ENET_API int enet_socketset_select (ENetSocket, ENetSocketSet *, ENetSocketSet *, enet_uint32);
|
||||||
|
|
13
unix.c
13
unix.c
|
@ -271,6 +271,19 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
|
||||||
return result == -1 ? -1 : 0;
|
return result == -1 ? -1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
enet_socket_get_option (ENetSocket socket, ENetSocketOption option, int * value)
|
||||||
|
{
|
||||||
|
int result = -1;
|
||||||
|
switch (option)
|
||||||
|
{
|
||||||
|
case ENET_SOCKOPT_ERROR:
|
||||||
|
result = setsockopt (socket, SOL_SOCKET, SO_ERROR, (char *) value, sizeof (int));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return result == -1 ? -1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
enet_socket_connect (ENetSocket socket, const ENetAddress * address)
|
enet_socket_connect (ENetSocket socket, const ENetAddress * address)
|
||||||
{
|
{
|
||||||
|
|
13
win32.c
13
win32.c
|
@ -201,6 +201,19 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
|
||||||
return result == SOCKET_ERROR ? -1 : 0;
|
return result == SOCKET_ERROR ? -1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
enet_socket_get_option (ENetSocket socket, ENetSocketOption option, int * value)
|
||||||
|
{
|
||||||
|
int result = SOCKET_ERROR;
|
||||||
|
switch (option)
|
||||||
|
{
|
||||||
|
case ENET_SOCKOPT_ERROR:
|
||||||
|
result = setsockopt (socket, SOL_SOCKET, SO_ERROR, (char *) value, sizeof (int));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return result == SOCKET_ERROR ? -1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
enet_socket_connect (ENetSocket socket, const ENetAddress * address)
|
enet_socket_connect (ENetSocket socket, const ENetAddress * address)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue