logo       

Re: determining an endpoint's family - endpoint_type/protocol_type?: msg#00022

lib.boost.asio.user

Subject: Re: determining an endpoint's family - endpoint_type/protocol_type?

Great! Thanks :)

Richard

On 11/20/06, Christopher Kohlhoff
<chris-34HiQXrhQN1Wk0Htik3J/w@xxxxxxxxxxxxxxxx> wrote:
> Hi Richard,
>
> Richard Dingwall <rdingwall-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote:
> > I am developing an FTP client with boost::asio, and I wish to
> > determine whether an endpoint (generated by a resolver) is
> > IPv4 or IPv6.
> >
> > The only way I can see how is to compare
> > endpoint.protocol().family() with AF_INET and AF_INET6, which
> > doesn't feel like the right way. An alternative would be to
> > specify the desired family before the host is resolved, or to
> > simply compare the endpoint's family against some predefined
> > boost::asio::ip::ipv6/ipv4 members.
> >
> > The difference between IPv4 and IPv6 is quite significant for
> > FTP, as they require a different set of (mostly incompatible)
> > commands to negotiate data connections.
> >
> > Any suggestions? (Probably I have missed something :)
>
> If you're using the version in CVS you can use
> endp.address().is_v4() or endp.address().is_v6().
>
> Another method in the TR2 proposal but not yet in CVS is the
> ability to test protocol objects for equality, e.g.:
>
> endp.protocol() == ip::tcp::v4()
>
> This seems to me to be the more natural expression for your use
> case, so I will make this change right away.
>
> Cheers,
> Chris
>
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> asio-users mailing list
> asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/asio-users
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise