pub async fn recv<R: AsyncRead + Unpin>(
stream: &mut R,
cipher: &Cipher,
) -> Result<BytesMut, PacketError>Available on crate feature
compress_encryption only.Expand description
Recv the message in tcp-handler compress_encrypt protocol.
§Runtime
Due to call block_in_place internally,
this function cannot be called in a current_thread runtime.
§Arguments
stream- The tcp stream orReadHalf.cipher- The cipher returned fromserver_startorclient_start.
§Example
use tcp_handler::protocols::compress_encrypt::recv;
let mut reader = recv(&mut server, &cipher).await?.reader();
let message = reader.read_string()?;