[][src]Trait internet2::transport::RecvFrame

pub trait RecvFrame {
    pub fn recv_frame(&mut self) -> Result<Vec<u8>, Error>;
pub fn recv_raw(&mut self, len: usize) -> Result<Vec<u8>, Error>; pub fn recv_routed(&mut self) -> Result<RoutedFrame, Error> { ... } }

Frame receiving type which is able to parse raw data (streamed or framed by an underlying overlaid protocol such as ZMQ, HTTP, Websocket).

For asynchronous version check [AsyncRecvFrame]

Required methods

pub fn recv_frame(&mut self) -> Result<Vec<u8>, Error>[src]

Receive a single frame of data structured as a byte string. The frame contains LNP framing prefix, which is used by upstream session-level protocols.

Errors

Returns only [Error::SocketError] if the overlaid protocol errors with I/O error type

pub fn recv_raw(&mut self, len: usize) -> Result<Vec<u8>, Error>[src]

Try to eceive len number of bytes and pack them as a frame. The actual amount of bytes received may differ for some protocols, like ZMQ, so the function should be used with caution!

Errors

Returns only [Error::SocketError] if the overlaid protocol errors with I/O error type

Loading content...

Provided methods

pub fn recv_routed(&mut self) -> Result<RoutedFrame, Error>[src]

Receive frame like with RecvFrame::recv_frame, but only originating from the specified remote address.

Returns

Tuple, consisting of two byte strings:

  • Received frame
  • Source of the frame (i.e. some id of the remote node that sent this frame). The id is specific for the underlying overlaid protocol.

Errors

Returns only [Error::SocketError] if the overlaid protocol errors with I/O error type

Panics

Default implementation panics, since most of the framing protocols do not support multipeer sockets and [RecFrame::recv_frame] must be used instead (currently only ZMQ-based connections support this operation)

Loading content...

Implementations on Foreign Types

impl RecvFrame for TcpStream[src]

Loading content...

Implementors

impl RecvFrame for WrappedSocket[src]

Loading content...