Boost.Socks Logo

PrevUpHomeNext
connect (1 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,
    endpoint const& ep,
    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.

Preconditions

The SyncStream should be connected to a SOCKS5 server. The endpoint might contain IPv4 or IPv6 addresses.

Example
boost::asio::connect(s, resolver.resolve(socks_host, socks_service));
socks::io::auth::none opt{};
socks::io::connect(s, app_host_endpoint, opt, ec);
Parameters

Name

Description

s

SyncStream connected to a SOCKS server.

ep

Application server endpoint.

opt

Authentication options.

ec

Error code.

Return Value

server bound address and port

References

Convenience header <boost/socks.hpp>


PrevUpHomeNext