
Hi Chris, christopher baus <christopher@baus.net> wrote:
It isn't clear to me, but it looks like it should be possible by passing numeric_service in the query flags, but on Windows AI_NUMERICSERV isn't defined and numeric_service == 0. Plus that leaks the rather ugly getaddrinfo() interface of using numeric strings.
It would be nice if the interface allowed:
ip::tcp::resolver::query query("foobar.com", 80);
Yeah, i didn't provide such an overload to avoid ambiguity between port numbers and flags arguments. Using the string "80" will work on windows even though AI_NUMERICSERV isn't defined by the implementation. You can also pass the numeric_service flag to optimise the call on platforms where it is supported, but it isn't absolutely required to have the numeric string converted. Another approach (although not strictly meeting your requirements) is to use the endpoint::port() setter function after resolution. Cheers, Chris