Boost.Socks Logo

PrevUpHomeNext

async_connect_v4

Asynchronously connect to the application server through a SOCKS4 server.

Synopsis

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

template<
    class AsyncStream,
    class CompletionToken>
DEDUCED
async_connect_v4(
    AsyncStream& s,
    endpoint const& ep,
    string_view ident_id,
    CompletionToken&& token);
Description

After this operation, the client can communicate All SOCKS4 CONNECT requests contain a ident_id to identify the user, where a connection without authentication can be represented with an empty id.

Preconditions

The AsyncStream should be connected to a SOCKS4 server. The endpoint must contain an IPv4 address.

Example
boost::asio::connect(s, resolver.resolve(socks_host, socks_service));
socks_io::async_connect_v4(
    s, app_host_endpoint, "username", ec,
    [](error_code ec, endpoint ep)
{
    if (!ec.failed())
    {
        // write to the application host
        do_write();
    }
});
Parameters

Name

Description

s

SyncStream connected to a SOCKS server.

ep

Application server endpoint.

ident_id

Client ident ID.

token

Completion token.

Return Value

server bound address and port

References

Convenience header <boost/socks.hpp>


PrevUpHomeNext