Reputation: 8695
I want to explicitly set the scheme (http vs https), the host and the port number when using Boost ASIO's tcp::iostream
class. I see plenty of examples where scheme and host are used together, but not with port, too. I get the impression that the port is being determined automatically. However, I need to set it explicitly.
Upvotes: 0
Views: 870
Reputation: 24174
First, the iostream
constructor takes parameters equivalent to a resolver::query
as the documentation clearly states. The first argument is the host, the second is the service (also known as port)
basic_resolver_query(
const std::string & host,
const std::string & service,
resolver_query_base::flags resolve_flags = address_configured);
Second, the boost:asio::ip::tcp::iostream
class does not support a scheme, it is strictly for TCP streams as the type implies. It does not perform SSL handshaking or encryption, so no HTTPS. If you desire additional functionality you will need to implement it yourself, likely using the boost::iostream
library as described in this question.
Upvotes: 1