Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accepting an IPV6 connection fails (at least on windows) #61

Open
samisallinen opened this issue Feb 8, 2019 · 0 comments
Open

accepting an IPV6 connection fails (at least on windows) #61

samisallinen opened this issue Feb 8, 2019 · 0 comments

Comments

@samisallinen
Copy link

samisallinen commented Feb 8, 2019

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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant