-
Notifications
You must be signed in to change notification settings - Fork 23
QuantumGate::Local::ConnectTo
Karel Donk edited this page Jun 2, 2018
·
11 revisions
Connects to a peer on the network. If there was an existing connection to that peer, that connection is re-used.
const std::pair<Result, PeerLUID> ConnectTo(const IPEndPoint& endpoint,
ConnectCallback&& connect_func = nullptr,
DisconnectCallback&& disconnect_func = nullptr) noexcept;
Name | Description |
---|---|
endpoint |
A QuantumGate::IPEndPoint object containing the endpoint to connect to. See QuantumGate::IPEndPoint for more details. |
connect_func |
A QuantumGate::ConnectCallback object containing the function to call when the connection was successful. This function doesn't get called when an existing connection is re-used. See QuantumGate Callbacks for more details. |
disconnect_func |
A QuantumGate::DisconnectCallback object containing the function to call when the connection closes after having been established. This function doesn't get called when an existing connection is re-used. See QuantumGate Callbacks for more details. |
Returns a std::pair
containing a QuantumGate::Result
and a PeerLUID
. The PeerLUID
contains the Locally Unique Identifier for the peer upon successful connection. The QuantumGate::Result
object can contain one of the following QuantumGate::ResultCode
s:
Value | Description |
---|---|
QuantumGate::ResultCode::Succeeded |
The operation succeeded. |
QuantumGate::ResultCode::SucceededAlreadyConnected |
The operation succeeded and an existing connection is being re-used. The PeerLUID of the existing connection is returned. |
QuantumGate::ResultCode::Failed |
The operation failed. |
QuantumGate::ResultCode::FailedRetry |
The operation failed but can be retried. |
QuantumGate::ResultCode::FailedNotRunning |
The operation failed because the instance isn't running. |
QuantumGate::ResultCode::FailedNotAllowed |
The operation failed because a connection to the specified endpoint is not allowed by the configured security and access settings. |