Function recv

Source
pub async fn recv<R: AsyncRead + Unpin>(
    stream: &mut R,
    cipher: &Cipher,
) -> Result<BytesMut, PacketError>
Available on crate feature encryption only.
Expand description

Recv the message in tcp-handler encrypt protocol.

§Runtime

Due to call block_in_place internally, this function cannot be called in a current_thread runtime.

§Arguments

§Example

use tcp_handler::protocols::encrypt::recv;

let mut reader = recv(&mut server, &cipher).await?.reader();
let message = reader.read_string()?;