On Thu Aug 22 15:11:42 2024 +0000, David Gow wrote:
Thanks very much! This seems to be working for Age of Empires 1 & 2 — at the very least, it resolves the issues with getting into the game lobby, and (in Age of Empires 2) starting a LAN game. Promising-looking packets are flowing. I haven't got a second copy of the game here to test an actual LAN multiplayer game fully at the moment, but this is definitely an improvement. Indeed, this works better than the [patch here](https://github.com/ValveSoftware/Proton/issues/3189#issuecomment-1823909045) did when I tested it, though that may be due to other wine or game updates since: the lobby no longer disconnects on AOE2. One minor thought about the implementation: does it need to support other broadcast addresses, not just 255.255.255.255? It's fine as-is for Age of Empires, but maybe something else cares.
Thanks! Yes, good point about generic broadcast addresses. I just removed the check for INADDR_BROADCAST, properly determining all the possible broadcast addresses is complicated. That shouldn't hurt as the condition with the present EACCES check (also received synchronously on nonblocking socket) looks already specific enough.
As a separate note, I tested locally with various broadcast masks and Windows results are mildly insane. sendto() with explicit address succeeds here on 192.168.0.255 without SO_BROADCAST set but still fails with SO_BROADCAST explicitly cleared. And then succeeds always regardless of SO_BROADCAST with 192.268.255.255 and 192.255.255.255. I think I don't want to address those specifics in the absence of anything depending on that (which is also less likely to be dependent upon looking at the inconsistency of this behaviour).