Search code examples
c++ip-addresspoco

Convert a Poco::IPAddress into ulong


Under boost there is :

boost::asio::ip::address_v4::from_string("192.168.0.10").to_ulong()

It convert 192.168.0.10 into 0xC0A8010A

which is very comfortable. Unfortunately, I don't have boost on this project but poco. I don't find any method which permit to do that.

Did I miss something ?


Solution

  • Use addr() method of POCO::IPAddress to get in_addr struct (if IPv4 is used). The S_addr field is your target ulong.