pub fn fionread<T: AsRaw + ?Sized>(sock: &T) -> Result<usize>
Expand description

Read the number of bytes available from a socket.

This function calls the FIONREAD ioctl on Unix and the ioctlsocket equivalent on Windows.

Example

let mut stream = TcpStream::connect(("google.com", 80))?;
let n = fionread(&stream)?;
println!("There are {} bytes available", n);