pub async fn send<W: AsyncWrite + Unpin, B: Buf>(
stream: &mut W,
message: &mut B,
cipher: &Cipher,
) -> Result<(), PacketError>Available on crate feature
compress_encryption only.Expand description
Send 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 orWriteHalf.message- The message to send.cipher- The cipher returned fromserver_startorclient_start.
§Example
use tcp_handler::protocols::compress_encrypt::send;
let mut writer = BytesMut::new().writer();
writer.write_string("hello server.")?;
send(&mut client, &mut writer.into_inner(), &cipher).await?;