You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey team, first of all, I want to thank you for adding IPv6 support and other features to the original ENet—nicely done! However, I'm encountering an issue on my Mac
#include<iostream>#defineENET_IMPLEMENTATION#include<enet.h>intmain(intargc, constchar*argv[])
{
if (enet_initialize () !=0)
{
return1;
}
ENetAddresslocalAddress;
memset(&localAddress, 0, sizeof(ENetAddress));
enet_address_set_host (&localAddress, "127.0.0.1");
localAddress.port=8973;
ENetHost*client=enet_host_create (&localAddress, 1, 2, 0, 0);
if (client==NULL)
{
exit (1);
}
ENetAddressremoteAddress=localAddress;
remoteAddress.port=1234;
ENetPeer*remoteServer=enet_host_connect (client, &remoteAddress, 2, 0);
if (remoteServer==NULL)
{
exit (1);
}
ENetEventevent;
/* Wait up to 5 seconds for the connection attempt to succeed. */if (enet_host_service (client, &event, 5000) >0&&event.type==ENET_EVENT_TYPE_CONNECT)
{
std::printf("Connection to server is succeeded.\n");
}
else
{
enet_peer_reset (remoteServer);
std::printf("Connection to server is failed. Either the 5 seconds are up or a disconnect event was received.\n");
}
enet_host_destroy(client);
enet_deinitialize();
return0;
}
Client output
Connection to server is failed. Either the 5 seconds are up or a disconnect event was received.
So, as you can see, the client never connects to the server.
Notes:
It seems like the culprit is enet_socket_receive - because after receiving the message via recvmsg the sockaddr_in6 sin actually contains sockaddr_in (the field sin6_family is set to AF_INET instead of AF_INET6) ¯\_(ツ)_/¯
Explicitly setting the IPv6 localAddress during socket creation/binding, like this: enet_address_set_host (&localAddress, "::ffff:127.0.0.1"); doesn't help
Explicitly setting the localAddress as "any" like this: localAddress.host = ENET_HOST_ANY;
instead of enet_address_set_host (&localAddress, "127.0.0.1"); doesn't help.
Environment:
macOS: Sequoia 15.2
Xcode 16.2
Apple M1 max
The text was updated successfully, but these errors were encountered:
I don't have a way to validate this issue on IPv6 stack right now unfortunately, but if the proposed fix works well and does not affect IPv4-only set up anyhow, we'd gladly accept a PR to get it merged in.
Hey team, first of all, I want to thank you for adding IPv6 support and other features to the original ENet—nicely done! However, I'm encountering an issue on my Mac
Minimum repro steps:
Server code
Client code
Client output
So, as you can see, the client never connects to the server.
Notes:
enet_socket_receive
- because after receiving the message viarecvmsg
thesockaddr_in6 sin
actually containssockaddr_in
(the fieldsin6_family
is set toAF_INET
instead ofAF_INET6
) ¯\_(ツ)_/¯localAddress
during socket creation/binding, like this:enet_address_set_host (&localAddress, "::ffff:127.0.0.1");
doesn't helplocalAddress
as "any" like this:localAddress.host = ENET_HOST_ANY;
instead of
enet_address_set_host (&localAddress, "127.0.0.1");
doesn't help.Environment:
The text was updated successfully, but these errors were encountered: