1

I passed an url http://2001:420:589a:2009::101/, which included an IPv6 address of my test server, to the constructor of http_listener and then called http_listener.open().wait(), unfortunately I got an exception saying resolve: Service not found.

I'm wondering how to listen on an IPv6 address correctly using cpprest http_listener. Or does http_listener not support IPv6 at all currently?

I'm using cpprestsdk v2.9.1.

Clíodhna
  • 818
  • 1
  • 15
  • 29
  • You must enclose the IPv6 address in square brackets for a URL: `http://[2001:420:589a:2009::101]/`. This is covered in _[RFC 2732, Format for Literal IPv6 Addresses in URL's](https://www.ietf.org/rfc/rfc2732.txt)_. – Ron Maupin Aug 25 '17 at 14:10
  • @RonMaupin Thanks for your reply. I have tried `http://[2001:420:589a:2009::101]/` but got an exception from cpprest-sdk saying `provided uri is invalid: http://[2001:420:589a:2009::101]/`. Seems web::uri in cpprest-sdk does not support ipv6 address with square brackets format yet. – Webber Zheng Aug 28 '17 at 02:29
  • To be more exact, I can successfully listen on an IPv4 address or an domain name which would be resolved into an IPv6 address, however listening on an IPv6 address is always failed. – Webber Zheng Aug 28 '17 at 07:22

0 Answers0