Boost logo

Boost :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2006-08-17 02:46:48


Hi Chris,

christopher baus <christopher_at_[hidden]> 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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk