Boost.Socks Logo

PrevUpHomeNext
connect (2 of 2 overloads)

Connect to the application server through a SOCKS5 server.

Synopsis

Defined in header <boost/socks/connect.hpp>

template<
    class SyncStream>
endpoint
connect(
    SyncStream& s,
    string_view app_domain,
    std::uint16_t app_port,
    auth_options const& opt,
    error_code& ec);
Description

This function establishes a connection to the application server through a SOCKS5 server. This composed operation includes the greeting, sub-negotiation, and connect steps of the SOCKS5 protocol. The application server is described as the domain name of the target host. According to the SOCKS5 protocol, this domain name is resolved on the SOCKS server.

Preconditions

The SyncStream should be connected to a SOCKS5 server. The endpoint might contain an IPv4 or IPv5 address.

Example
boost::asio::connect(s, resolver.resolve(socks_host, socks_service));
socks::io::connect(s, "www.example.com", 80, "username", ec);
Parameters

Name

Description

s

SyncStream connected to a SOCKS server.

app_domain

Domain name of the application server

app_port

Port of the application server

opt

Authentication options

ec

Error code

References

Convenience header <boost/socks.hpp>


PrevUpHomeNext