ConnectDirectly

Create a socket and try to connect to the specified service, using the provided timeout.

Synopsis

Declared in <netbase.h>

std::unique_ptr<Sock>
ConnectDirectly(
    CService const& dest,
    bool manual_connection,
    std::chrono::milliseconds timeout);

Return Value

the connected socket if the operation succeeded, empty unique_ptr otherwise.

Parameters

NameDescription
dest [in]The service to which to connect.
manual_connection [in]Whether or not the connection was manually requested (e.g. through the addnode RPC).
timeout [in]How long to wait for the connection before giving up.