Jump to content
  • Advertisement
Sign in to follow this  

boost ip address weird behaviour

This topic is 1105 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;
cout << test.is_v4();
cout << test.to_v4().to_string();

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


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


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;
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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!