Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4627478
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:34:25+00:00 2026-05-22T03:34:25+00:00

I’m attempting to make my networked application work locally (with both the server and

  • 0

I’m attempting to make my networked application work locally (with both the server and client running on the same computer) when there is no network connection. This seems to “just work” occasionally, but most of the time I end up with:

terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'
       what(): Host not found (authoritative)
    Aborted

The code I’m currently using is:

  tcp::resolver::query query(host, PORT);
  tcp::resolver::iterator endpointIterator = resolver.resolve(query);
  tcp::resolver::iterator end;

  boost::system::error_code error = boost::asio::error::host_not_found;
  while(error && endpointIterator != end)
  {
    mySocket.close();
    mySocket.connect(*endpointIterator++, error);
  }
  if(error)
    throw boost::system::system_error(error);

I’m pretty sure I’ve narrow the problem down to ip::basic_resolver::resolve, but I can’t figure out how that’s implemented on Linux or what else I might want to use. This seems to be the same issue. It seems that just not performing any lookup at all and just using 127.0.0.1 should work, but when I tried replacing the query line with

tcp::resolver::query query(host, PORT, boost::asio::ip::resolver_query_base::address_configured | boost::asio::ip::resolver_query_base::numeric_host

it didnt’ work.
As I was writing this I found my mistake, the address_configured flag (which is set by default) prevents resolve from returning if the loopback device is the only one with an address. I’m still posting this question in the hopes that it helps someone else, but I’ve solved my issue.

Now I use

tcp::resolver::query query(host, PORT, boost::asio::ip::resolver_query_base::numeric_service);

Though other people might not want the flag I’m using if they do want to lookup service names (I’m just using port numbers).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:34:26+00:00Added an answer on May 22, 2026 at 3:34 am

    The problem was that the constructor for query has the address_configured flag set by default which won’t return an address if the loopback device is the only device with an address. By just settings flags to 0 or anything other than address_configured the problem is fixed.
    Here is what I’m successfully using now:

    tcp::resolver::query query(host, PORT, boost::asio::ip::resolver_query_base::numeric_service);
    

    Hope this helps anyone with this problem in the future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.