https://bugs.winehq.org/show_bug.cgi?id=50352
Bug ID: 50352 Summary: Maximum sockets per process is set very low Product: Wine Version: 5.22 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: winsock Assignee: wine-bugs@winehq.org Reporter: skreech@skree.ch Distribution: ---
Created attachment 68942 --> https://bugs.winehq.org/attachment.cgi?id=68942 TWGS warning at startup
Within wine-5.22/dlls/ws2_32/socket.c, the maximum number of sockets per process is set and used like so:
#define WS_MAX_SOCKETS_PER_PROCESS 128 /* reasonable guess */
and:
lpWSAData->iMaxSockets = WS_MAX_SOCKETS_PER_PROCESS;
This became relevant when I ran the TradeWars 2002 game server (TWGS) under a maximum license allowing 100 simultaneous players. On startup, it logs a message warning that the OS's number of sockets per process is limited to 128, therefore no more than 63 players will be able to connect. This makes sense, since two sockets are required per player connection, and one SysOp connection is reserved.
Changing WS_MAX_SOCKETS_PER_PROCESS to 1024 and recompiling WINE results in TWGS not experiencing this limit and not giving the warning.
Also, I tested TWGS under ReactOS and did not experience limit nor warning. Peeking into their socket.c, I notice that their limit is set to 32767, or 0, depending:
https://github.com/reactos/reactos/search?q=iMaxSockets
It seems likely that WS_MAX_SOCKETS_PER_PROCESS should be set to 32767 here if any value is being set, given that the underlying OS should be the one imposing its own limits or lack of limit.