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

  • SEARCH
  • Home
  • 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 151129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:24:02+00:00 2026-05-11T09:24:02+00:00

I am starting Boost.Asio and trying to make examples given on official website work.

  • 0

I am starting Boost.Asio and trying to make examples given on official website work.
here`s client code:

 using boost::asio::ip::tcp;  int _tmain(int argc, _TCHAR* argv[]) {     try {         boost::asio::io_service io_service;          tcp::resolver resolver(io_service);         tcp::resolver::query query(argv[1], 'daytime');         tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);         tcp::resolver::iterator end;          tcp::socket socket(io_service);         boost::system::error_code error = boost::asio::error::host_not_found;         while(error && endpoint_iterator != end) {             socket.close();             socket.connect(*endpoint_iterator++, error);         }         if (error)             throw boost::system::system_error(error);          for(;;) {             boost::array buf;             boost::system::error_code error;              std::size_t len = socket.read_some(boost::asio::buffer(buf), error);              if (error == boost::asio::error::eof)                 break; //connection closed cleanly by peer             else if (error)                 throw boost::system::system_error(error);              std::cout.write(buf.data(), len);         }     }     catch(std::exception& e) {         //...     }     return 0; } 

The question is – I can not find out what the parameters would be to run program from command prompt?

  • 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. 2026-05-11T09:24:03+00:00Added an answer on May 11, 2026 at 9:24 am

    You would run the program with the IP or Hostname of the server you want to connect to. tcp::resolver::query takes the host to resolve or the IP as the first parameter and the name of the service (as defined e.g. in /etc/services on Unix hosts) – you can also use a numeric service identifier (aka port number). It returns a list of possible endpoints, as there might be several entries for a single host.

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

Sidebar

Related Questions

I'm trying to write a SSL-based async server using Boost ASIO example code from
Is I am looking at writing a multithreaded tcp server using boost ASIO. I
I'm starting with boost asio programming in C++ and when looking over the examples
Man... thought using ASIO in Boost was going to be easy and intuitive. :P
I'm trying to learn boost::asio for socket/networking programming. I'm trying to send some simple
I'm writing a code using both Qt and boost. I know that qt window
As I am starting a project with boost lib, it seems my set-up isn't
using gingerbread 2.3.4 api lvl 10. I am starting a service after boot completed.
I am starting a new c++ project and I want to use Boost.Build /
I have a class which shall be capable of dispatching messages over TCP. Here

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.