/// Read data from the socket.
///
/// This pulls data from the socket into the read buffer
/// and only returns `Ready` when the socket has closed.
Read data from the socket.
This pulls data from the socket into the read buffer
and only returns `Ready` when the socket has closed.
Read data from the socket . This pulls data from the socket into the read buffer and only returns ` Ready ` when the socket has closed .
pub fn poll_read(&mut self) -> Poll<(), io::Error> {
        loop {
            // Reserve capacity for incoming bytes.
            //
            // TODO: Impose bounds to avoid potential allocation.
            self.rd.reserve(1024);
            // Pull data into the buffer.
            let n = try_ready!(self.socket.read_buf(&mut self.rd));
            // If the socket is ready to read from but doesn't return
            // any bytes, the connection has closed and we can stop
            // polling.
            if n == 0 {
                return Ok(Async::Ready(()));
            }
        }
    }
pub fn poll_read ( & mut self ) -> Poll < ( ) , io :: Error > { loop { // Reserve capacity for incoming bytes. // // TODO: Impose bounds to avoid potential allocation. self . rd . reserve ( 1024 ) ; // Pull data into the buffer. let n = try_ready ! ( self socket read_buf ( mut self rd ) ) ; // If the socket is ready to read from but doesn't return // any bytes, the connection has closed and we can stop // polling. if n == 0 { return Ok ( Async :: Ready ( ( ) ) ) ; } } }
Read data from the socket.
Read data from the socket .
&mut self