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 3306112
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:14:59+00:00 2026-05-17T21:14:59+00:00

Boost.asio documentation doesn’t support any ftp examples. `boost::asio::io_service io_service; tcp::resolver resolver(io_service); tcp::resolver::query query(www.boost.org, http);

  • 0

Boost.asio documentation doesn’t support any ftp examples.

 `boost::asio::io_service io_service;
tcp::resolver resolver(io_service);
tcp::resolver::query query("www.boost.org", "http");
tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);`

that resolve http site and get an HTTP endpoint.

but tcp::resolver::query query("ftp://ftp.remotesensing.org/gdal/", "ftp");

that result a Host not found ERROR. So how to resolve a ftp site.

  • 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-17T21:15:00+00:00Added an answer on May 17, 2026 at 9:15 pm

    For one you’ve still got the ftp:// in your host name, AFAIR your host name should be “ftp.remotesensing.org”

    #include "stdafx.h"
    
    #include <iostream>
    #include <boost/asio.hpp>
    
    using namespace boost::asio::ip;
    using namespace std;
    
    int _tmain(int argc, _TCHAR* argv[])
    {
      try
      {
    
        boost::asio::io_service io_service;
        tcp::resolver resolver(io_service);
    
        tcp::resolver::query query("ftp.remotesensing.org", "ftp");
        tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
        tcp::resolver::iterator end;
        // Try each endpoint until we successfully establish a connection.
        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)
        {
          cout << "socket connected: " << socket.is_open() << endl;
          // Read the response status line. The response streambuf will automatically
          // grow to accommodate the entire line. The growth may be limited by passing
          // a maximum size to the streambuf constructor.
          boost::asio::streambuf response;
          boost::asio::read_until(socket, response, "\r\n");
    
          std::istream response_stream(&response);
          std::string sResponse;
          while (!response_stream.eof())
          {
            response_stream >> sResponse;
            cout << sResponse << " ";
          }
        }
        else
        {
          cout << "Error: " << error.message() << endl;
        }
    
      }catch(std::exception& e)
      {
        std::cout << e.what() << std::endl;
      }
    
      return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just seen this inside <boost/asio.hpp> #ifndef BOOST_ASIO_HPP #define BOOST_ASIO_HPP #if defined(_MSC_VER) && (_MSC_VER >=
I have written the following code #include <iostream> #include <boost/asio.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/filesystem.hpp>
This boost udp server doesn't function as expected. It is identical to the blocking
Does boost provide any classes to implement a tridiagonal matrix?
on boost, to create a time facet to format an specified time we use
I'm using boost::iostreams::gzip_decompressor with boost::iostreams::filterimg_streambuf to read gzip files. some of my files have
Could someone point me to the source code for an ideally multi-threaded C++ TFTP
I haven't done work in C/C++ for a little bit and was just wondering
We're needing to write small fast code on the windows platform and I know
I expected the code below to print Hello, world! every 5 seconds, but what

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.