Boost logo

Boost Users :

Subject: [Boost-users] [Asio] Common method of converting boost::asio::ip::address to network for both v4() and v6() addresses ?
From: Sean Ryan (sryan_at_[hidden])
Date: 2011-05-27 15:53:43


 Greetings,

 As a short background, I have a protocol which transfers IPs by
 converting to a uint32_t and then shifting out the bytes on the other
 end.

 For example: 127.0.1.1 = 2130706689

 Clearly, this won't work for an ipv6 address, as requires more bytes.

 The address 127.0.1.1 represents as:

 v6():
 endpoint.address().to_string() yields
 ::ffff:127.0.1.1

 v4():
 endpoint.address().to_string() yields
 127.0.1.1

 Is there a method within the boost implementation that would allow ( or
 assist ) an effort to a uniform interpretation of the
 boost::asio::ip::address ( I expect this will likely involve the
 utin64_t over the 32 ... which I can live with ) ?

 Many thanks,
 Sean


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net