Skip to content

IPv6 support #128

@anarthal

Description

@anarthal

At the moment, tcp_socket::connect only supports IPv4 (at least on Linux). You probably need to support IPv6, too.

From the Linux manpage, you need AF_INET6 for IPv6. This is currently a problem because open always uses AF_INET, which is v4. I don't know about other OSes. You might want to have a look at the IPV6_V6ONLY flag, which might be useful.

You shouldn't re-open sockets on connect because the user might have set options on them (potentially via native_handle()).

Related, Asio makes socket::connect open the socket if it wasn't open yet. You might consider implementing it, too. Also, Asio allows setting options after connect, so caching options to apply them further might not be the best path.

My suggestion is:

  • open either sets IPV6_V6ONLY and always uses AF_INET6, or is split into open_v4 and open_v6.
  • You can set options on an open socket.
  • connect opens the socket if it wasn't open yet.
  • You need to update connect to handle v6.

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