pub async fn send<W: AsyncWrite + Unpin, B: Buf>(
stream: &mut W,
message: &mut B,
) -> Result<(), PacketError>
Expand description
Send the message in tcp-handler raw protocol.
§Arguments
stream
- The tcp stream orWriteHalf
.message
- The message to send.
§Example
use tcp_handler::protocols::raw::send;
let mut buffer = BytesMut::new().writer();
buffer.write_string("hello server!")?;
send(&mut client, &mut buffer.into_inner()).await?;