WINDOWS socket cannot listen more than 63 sockets
Description
WINDOWS socket should not have any limitation on the number of sockets
Code version identification
158239bab1ae0
Current behavior
Windows 'select' C function can only listen to 64 elements, thus limiting the actual possible range of sockets connections.
See https://learn.microsoft.com/en-us/windows/win32/winsock/maximum-number-of-sockets-supported-2
Security impact
None (availability issue)
Implementation
(Proposition): Use this updated API instead of select:
WSAPOLLFD fds[1024];
fds[0].fd = socket_fd;
fds[0].events = POLLIN | POLLOUT;
int result = WSAPoll(fds, 1, timeout_ms);
Other options:
- WSAPoll (scalable, very close to
selectAPI (less rework) - WSAEventSelect() + WSAWaitForMultipleEvents() (adapted to range ~ 100-200 sockets)
- WSARecv (overlapped IO) (Much more complex)
Edited by Jérémie Chabod