[][src]Trait internet2::transport::SendFrame

pub trait SendFrame {
    pub fn send_frame(&mut self, frame: &[u8]) -> Result<usize, Error>;
pub fn send_raw(&mut self, raw_frame: &[u8]) -> Result<usize, Error>; pub fn send_routed(
        &mut self,
        _source: &[u8],
        _route: &[u8],
        _address: &[u8],
        _data: &[u8]
    ) -> Result<usize, Error> { ... } }

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

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
Loading content...

Provided methods

pub fn send_routed(
    &mut self,
    _source: &[u8],
    _route: &[u8],
    _address: &[u8],
    _data: &[u8]
) -> Result<usize, Error>
[src]

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

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)

Loading content...

Implementations on Foreign Types

impl SendFrame for TcpStream[src]

Loading content...

Implementors

impl SendFrame for WrappedSocket[src]

Loading content...