Sign in to follow this  

boost ip address weird behaviour

This topic is 819 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

boost::asio::ip::address test;
test.from_string("192.169.2.1");
cout << test.is_v4();
cout << test.to_v4().to_string();

The first cout outputs a 1. However, the second one outputs the following address:

10.0.0.0

 

Why would the to_string() method return that, when I clearly set the ip to 192.169.2.1

 

Also, with an ipv6, i get the following exception:

Microsoft C++ exception: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::bad_cast> > at memory location 0x0087F8C0.

 

for the code:

boost::asio::ip::address test;
test.from_string("FE80:0000:0000:0000:0202:B3FF:FE1E:8329");
cout << test.is_v6(); //RETURNS 0
cout << test.to_v6().to_string(); //CAUSES THE ABOVE EXCEPTION

Share this post


Link to post
Share on other sites

This topic is 819 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this