Skip to content

Commit

Permalink
Set socket option IPV6_V6ONLY before bind()
Browse files Browse the repository at this point in the history
  • Loading branch information
K-os committed Aug 25, 2015
1 parent 2b52599 commit 2a567b0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion host.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ enet_host_create (const ENetAddress * address, size_t peerCount, size_t channelL
memset (host -> peers, 0, peerCount * sizeof (ENetPeer));

host -> socket = enet_socket_create (ENET_SOCKET_TYPE_DATAGRAM);
if( host -> socket > ENET_SOCKET_NULL )
enet_socket_set_option (host -> socket, ENET_SOCKOPT_IPV6_V6ONLY, 0);
if (host -> socket == ENET_SOCKET_NULL || (address != NULL && enet_socket_bind (host -> socket, address) < 0))
{
if (host -> socket != ENET_SOCKET_NULL)
Expand All @@ -64,7 +66,6 @@ enet_host_create (const ENetAddress * address, size_t peerCount, size_t channelL
enet_socket_set_option (host -> socket, ENET_SOCKOPT_BROADCAST, 1);
enet_socket_set_option (host -> socket, ENET_SOCKOPT_RCVBUF, ENET_HOST_RECEIVE_BUFFER_SIZE);
enet_socket_set_option (host -> socket, ENET_SOCKOPT_SNDBUF, ENET_HOST_SEND_BUFFER_SIZE);
enet_socket_set_option (host -> socket, ENET_SOCKOPT_IPV6_V6ONLY, 0);


if (address != NULL && enet_socket_get_address (host -> socket, & host -> address) < 0)
Expand Down

0 comments on commit 2a567b0

Please sign in to comment.