Skip to content

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

Description

@samisallinen

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);
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions