Skip to content

QuantumGate::Extender::SendMessageTo

Karel Donk edited this page Oct 27, 2021 · 7 revisions

Sends data to a peer on the network. All the data in the buffer is sent at once or not at all. If there isn't enough room in the peer send buffer to send all data at once the function call fails and can be retried. To send only a portion of the data when possible use the SendMessage function.

Signature

  1. Result<> SendMessageTo(const PeerLUID pluid, Buffer&& buffer, const SendParameters& params,
                           SendCallback&& callback = nullptr) const noexcept;
  2. Result<> SendMessageTo(Peer& peer, Buffer&& buffer, const SendParameters& params,
                           SendCallback&& callback = nullptr) const noexcept;

Parameters

Name Description
pluid A QuantumGate::PeerLUID with the Locally Unique Identifier of the connected peer.
peer A QuantumGate::Peer object representing the connected peer.
buffer A QuantumGate::Buffer object containing the data to send. The size of the buffer should not be greater than the value returned by the QuantumGate::Extender::GetMaximumMessageDataSize function.
params A QuantumGate::SendParameters object containing the parameters to use when sending.
callback A QuantumGate::SendCallback object containing the function to call after the data has been sent. See QuantumGate Callbacks for more details. This parameter defaults to nullptr. Note that QuantumGate doesn't guarantee that the data has actually been delivered when this callback gets invoked -- only that it has been transmitted or is in the process of being transmitted. Extenders should implement their own mechanisms for acknowledging that the data has actually been delivered when required.

Return values

Returns a QuantumGate::Result object equal to one of the following QuantumGate::ResultCodes:

Value Description
QuantumGate::ResultCode::Succeeded The operation succeeded.
QuantumGate::ResultCode::Failed The operation failed.
QuantumGate::ResultCode::FailedRetry The operation failed but can be retried. This can happen when the extender is not yet (fully) ready.
QuantumGate::ResultCode::OutOfMemory The operation failed because of a memory allocation failure.
QuantumGate::ResultCode::PeerNotFound The operation failed because the peer wasn't found.
QuantumGate::ResultCode::PeerNoExtender The operation failed because the peer doesn't have the extender running.
QuantumGate::ResultCode::PeerNotReady The operation failed because the peer wasn't ready (it may still be connecting or was disconnected).
QuantumGate::ResultCode::PeerSendBufferFull The operation failed because the send buffer for the peer is full. Retry sending later.
QuantumGate::ResultCode::PeerSuspended The operation failed because the connection to the peer is suspended. Retry sending later.
QuantumGate::ResultCode::NotRunning The operation failed because either the local instance or the extender isn't running.
Clone this wiki locally