[−][src]Trait internet2::transport::SendFrame
Frame sending type which is able to compose frame with a given raw data and send it via an underlying overlaid protocol such as ZMQ, HTTP, Websocket.
For asynchronous version check [AsyncSendFrame
]
Required methods
pub fn send_frame(&mut self, frame: &[u8]) -> Result<usize, Error>
[src]
Sends a single frame of data structured as a byte string. The frame must
already contain LNP framing prefix with size data. The function must
check that the provided data frame length is below the limit defined
with MAX_FRAME_SIZE
constant.
Returns
In case of success, number of bytes send (NB: this is larger than the
message payload size and is equal to the size of the provided frame
argument)
Errors
- [
Error::SocketError
] if the overlaid protocol errors with I/O error type Error::OversizedFrame
if the provided data length exceedsMAX_FRAME_SIZE
pub fn send_raw(&mut self, raw_frame: &[u8]) -> Result<usize, Error>
[src]
Sends a single frame of data structured as a byte string. The frame must already contain LNP framing prefix with size data.
NB: Unlike SendFrame::send_frame
, this function does not check
that the provided data frame length is below the limit defined with
MAX_FRAME_SIZE
constant.
Returns
In case of success, number of bytes send (NB: this is larger than the
message payload size and is equal to the size of the provided
raw_frame
argument)
Errors
- [
Error::SocketError
] if the overlaid protocol errors with I/O error type
Provided methods
pub fn send_routed(
&mut self,
_source: &[u8],
_route: &[u8],
_address: &[u8],
_data: &[u8]
) -> Result<usize, Error>
[src]
&mut self,
_source: &[u8],
_route: &[u8],
_address: &[u8],
_data: &[u8]
) -> Result<usize, Error>
Sends a single frame of data structured as a byte string to a specific
receiver with remote_id
. Function works like RecvFrame::recv_frame
and is used for the underlying protocols supporting multipeer
connectivity. The frame must already contain LNP framing prefix with
size data. The function must check that the provided data frame
length is below the limit defined with MAX_FRAME_SIZE
constant.
Returns
In case of success, number of bytes send (NB: this is larger than the
message payload size and is equal to the size of the provided frame
argument)
Errors
- [
Error::SocketError
] if the overlaid protocol errors with I/O error type Error::OversizedFrame
if the provided data length exceedsMAX_FRAME_SIZE
Panics
Default implementation panics, since the most of framing protocols do
not support multipeer sockets and SendFrame::send_frame
must be
used instead (currently only ZMQ-based connections support this
operation)