Opened 6 years ago

Last modified 6 years ago

#12316 new Bugs

ASIO: "Undefined error: 0" on the Mac OS 10.10 and 10.11

Reported by: David Dovodov <ddovod@…> Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.61.0 Severity: Problem
Keywords: Cc:

Description

Hello. I have some issue with asio. When I try to connect/read/write (blocking and async operations), i get "Undefined error: 0" in the boost::error_code parameter. Interesting thing is that data transfers successfully. Only problem is Undefined error and infinity reads with zero bytes read. iOS (device and simulator) has this error too. If there's nobody listening on the port I try to connect to, "Connection refused" error is returned to the async_connect callback (which is correct behavior). So "Undefined error: 0" appears only if somebody is listening port on the other side.

Compiling with xCode and standalone clang with command like clang++ -std=c++11 -Ipath/to/asio/include async_tcp_echo_server.cpp -oserver

There's an issue on the asio's github tracker, but there's no activity at all. https://github.com/chriskohlhoff/asio/issues/121

Thank you a lot!

Change History (6)

comment:1 by anonymous, 6 years ago

0 == success ?

comment:1 by anonymous, 6 years ago

0 == success ?

comment:2 by David Dovodov <ddovod@…>, 6 years ago

AFAIK 0 is default value for error code, so it looks like this error code is uninitialized

comment:3 by David Dovodov <ddovod@…>, 6 years ago

Good day for everybody. Is there any info for this issue?

comment:4 by David Dovodov <ddovod@…>, 6 years ago

Update: examples works fine, sorry, my bad. Assuming there's somebody who is listening 8888 port on the localhost. The code below works bad on iOS/mac os:

std::string m_address = "127.0.0.1"; int m_port = 8888; asio::io_service m_service; asio::ip::tcp::socket m_socket(m_service); asio::ip::tcp::endpoint ep(asio::ip::address::from_string(m_address), m_port); m_socket.async_connect(ep, [] (const asio::error_code& err) {

std::cout << "onConnect -> " << err.message() << std::endl;

}); m_service.run();

Output on a Debian: onConnect -> Success

Output on a Mac OS: onConnect -> Undefined error: 0

comment:5 by anonymous, 6 years ago

I am having the same problem exactly. Is there any workaround?

Note: See TracTickets for help on using tickets.