Repository navigation
Conversation
|
Which call exactly was failing? I think we need to handle the IPv4 vs IPv6 somewhere because in general I think this approach is the intended one: Use |
|
Unfortunately, I'm not very familiar with the networking internals, my agent found the issue and fixed it minimally. I tested it and it works on my Mac. Here is its answer: Which call exactly was failing
return sendto(socket_, reinterpret_cast<const char*>(buffer), length, 0, addr.GetAddr(), addr.GetSize());
Why it failsOn Darwin The 17 and 29 cases are included to show that this is not a "too large" limit but an Linux only checks that Effect
About passing the IPv4 size (your IPv6 remark)You are right that With the current code, though, the one-line change cannot regress v6: Two possible ways to go: Option A – minimal (what my fork currently has)- int GetSize() const { return sizeof(addr); }
+ int GetSize() const { return sizeof(addr.sa_in); }Option B – family-aware, if you want it to be v6-correct as well// Socket.h, class PeerAddr
int GetSize() const
{
return addr.sa.sa_family == AF_INET6 ? static_cast<int>(sizeof(addr.sa_in6))
: static_cast<int>(sizeof(addr.sa_in));
}// Socket.cpp, Socket::Recv(void* const buffer, const int length, PeerAddr& addr)
// in/out parameter: buffer capacity, not the address length
socklen_t addrLen = sizeof(address_t);Option B needs the
|
|
Option B would be the correct option then. the GetSize must be protocol-aware, if |
|
See #46 - Can you test it? |
LAN game hosting was broken on macOS, making it impossible to host local multiplayer games.
PeerAddr::GetSize() returned the size of the entire sockaddr_storage structure instead of the IPv4 address structure (sockaddr_in). This caused sendto() to fail on macOS with EINVAL.
The fix uses sizeof(addr.sa_in) to return the correct address length. A related Info.plist change is required in the main s25client repository for the complete fix.