Stiffstream / restinio

Cross-platform, efficient, customizable, and robust asynchronous HTTP(S)/WebSocket server C++ library with the right balance between performance and ease of use
Other
1.15k stars 93 forks source link

both ipv4 & ipv6 support at runtime #30

Closed binarytrails closed 5 years ago

binarytrails commented 5 years ago

Is the IPV6 supported or is it planned to be supported in a near future?

Thank you!

eao197 commented 5 years ago

Is the IPV6 supported

Supported. See server's setting chapter.

binarytrails commented 5 years ago

@eao197 oh yes I saw this actually, I'm doing the same for the client but I mean at runtime because these settings are set before running the restinio main loop. Does RESTinio support both at runtime? Because I had trouble figuring out why it only accepts ipv4 or ipv6 connections once started

binarytrails commented 5 years ago

I saw that you can do ip version independent with restinio::asio_ns https://www.boost.org/doc/libs/1_42_0/doc/html/boost_asio/reference/ip__address.html

eao197 commented 5 years ago

To create asio::ip::tcp::endpoint we should specify a protocol. The corresponding fragment is here. Protocol is being got from server settings (by default it is ipv4), but can be changed to ipv6.

binarytrails commented 5 years ago

@eao197 so both are not supported simultaneously at runtime? you can only start in ipv4 or ipv6, right?

eao197 commented 5 years ago

I think your question is not related to RESTinio, but to Asio: https://stackoverflow.com/questions/31125229/accept-ipv4-and-ipv6-together-in-boostasio

binarytrails commented 5 years ago

Oh well, I guess it could be simply said that one does not have to set settings.address and set settings.protocol(restinio::asio_ns::ip::tcp::v6()) as said in your link:

If you create a IPv6 acceptor, it will accept both IPv4 and IPv6 connections if IPV6_V6ONLY socket option is cleared.

Which is the case by default in RESTinio. Thanks!