Skip to main content

read_into_buffer

Function read_into_buffer 

Source
pub async fn read_into_buffer(
    stream: &mut TcpStream,
    buffer: &mut [u8],
) -> Result<usize>
Expand description

Reads data from a TCP stream into a buffer.

Returns the number of bytes read, or 0 if the connection was closed.

This is a thin wrapper around AsyncRead::poll_read exposed for use in custom connection handlers that need low-level stream I/O.