I have a C++ boost client that does a blocking connect and processes the message once it receives a response. I am facing a strange issue.
tcp::resolver::query query(tcp::v6(), this->host, port,tcp::resolver::query::v4_mapped);
iterator = resolver.resolve(query);
socket = new tcp::socket(io_service);
socket->connect(*iterator);
I tried to connect to a machine that was not reachable by ping6 (but was IPV6 enabled). Still, I didn't get any error while trying to resolve the query in line-2. As a result of this, it takes too much time while attempting a connection before giving an error. My questions:-
1) Is it possible to timeout on a blocking connect from asio? I cannot switch to async mode of operation.
2) How come I don't get an error while it resolves an unreachable host?
Any advice would be very much helpful