send

Function send 

Source
pub fn send(
    fd: RawFd,
    buf: Vec<u8>,
    flags: Option<i32>,
) -> OperationProgress<Send> 
Expand description

Sends data on a connected socket.

§Returns

This function returns OperationProgress<Send>. This function signature is equivalent to:

async fn send(RawFd, Vec<u8>, Option<i32>) -> BufResult<i32, Vec<u8>>

§Behavior

As soon as this function is called, the operation is submitted into the io-driver used by the current platform (for example io-uring). If the user then chooses to drop OperationProgress before the Future is ready, the operation will NOT tried be cancelled, but instead “detached”.

See more what methods are available to the return type.

§Examples

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