Opened 7 years ago

Last modified 7 years ago

#11808 new Bugs

ip::address::from_string() is not crossplatform

Reported by: reinterpret.alexey@… Owned by: chris_kohlhoff
Milestone: Boost 1.59.0 Component: asio
Version: Boost 1.59.0 Severity: Problem
Keywords: WSAStringToAddressA Cc:

Description

On Windows WSAStringToAddressA() accepts A.B.C.D and A.B.C.D:PORT, but on linux inet_pton only accepts A.D.B.D (:PORT causes an error). Therefore, Windows users don't have an exception that linux users have.

Change History (1)

comment:1 by anonymous, 7 years ago

#include <boost/asio.hpp> #include <iostream>

using namespace std; using namespace boost::asio;

int main() {

try {

cout << "Address: " << ip::address::from_string("127.0.0.1:80") << "\n";

} catch (...) {

cout << "Exception.\n"; < Not reached on Windows

} return 0;

}

Note: See TracTickets for help on using tickets.