Skip to main content

send

Function send 

Source
pub fn send<B>(res: &impl AsResource, buf: B, flags: Option<i32>) -> Io<Send<B>>
where B: BufLike + Send + Sync,
Expand description

Sends data on a connected socket.

Equivalent to the send(2) syscall.

ยงExamples

async fn send_example() -> std::io::Result<()> {
    let data = b"Hello, server!".to_vec();
    let (bytes_sent, _buf) = lio::api::send(&fd, data, None).await;
    println!("Sent {} bytes", bytes_sent?);
    Ok(())
}