Corrected UDP client

parent aeba2bef
......@@ -53,17 +53,20 @@ ENetSocket UDPClient::initSocket(enet_uint16 port, bool bindSocket)
address.host = ENET_HOST_ANY;
address.port = port;
if (bindSocket && enet_socket_bind(socket, &address) != 0)
{
cerr << "eNet: Failed to bind listen socket" << endl;
return ENET_SOCKET_NULL;
}
if (enet_socket_get_address(socket, &address) != 0)
{
cerr << "eNet: Cannot get listen socket address" << endl;
return ENET_SOCKET_NULL;
}
if (bindSocket)
{
if (enet_socket_bind(socket, &address) != 0)
{
cerr << "eNet: Failed to bind listen socket" << endl;
return ENET_SOCKET_NULL;
}
if (enet_socket_get_address(socket, &address) != 0)
{
cerr << "eNet: Cannot get listen socket address" << endl;
return ENET_SOCKET_NULL;
}
}
return socket;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment