Open samisallinen opened 5 years ago
At least on windows, one can't accept an IPV6 connection with sockaddr_in in accept(). With the current code, e.g. telnet would connect to the v6 port, but accept() would always fail.
This seems to work (for both v4 and v6 connections):
NOPOLL_SOCKET nopoll_listener_accept (NOPOLL_SOCKET server_socket) { struct sockaddr_in6 inet_addr; #if defined(NOPOLL_OS_WIN32) int addrlen; #else socklen_t addrlen; #endif addrlen = sizeof(inet_addr); /* accept the connection new connection */ return accept (server_socket, (struct sockaddr *)&inet_addr, &addrlen); }
At least on windows, one can't accept an IPV6 connection with sockaddr_in in accept(). With the current code, e.g. telnet would connect to the v6 port, but accept() would always fail.
This seems to work (for both v4 and v6 connections):