/// Receives data from the socket. On success, returns the number of bytes
/// read and the address from whence the data came.
///
/// # Panics
///
/// This function will panic if called outside the context of a future's
/// task.
Receives data from the socket. On success, returns the number of bytes
read and the address from whence the data came.
Receives data from the socket . On success returns the number of bytes read and the address from whence the data came .
pub fn recv_from(&mut self, buf: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
        if let Async::NotReady = self.io.poll_read() {
            return Err(io::ErrorKind::WouldBlock.into())
        }
        match self.io.get_ref().recv_from(buf) {
            Ok(n) => Ok(n),
            Err(e) => {
                if e.kind() == io::ErrorKind::WouldBlock {
                    self.io.need_read()?;
                }
                Err(e)
            }
        }
    }
pub fn recv_from ( & mut self , buf : & mut [ u8 ] ) -> io :: Result < ( usize , SocketAddr ) > { if let Async :: NotReady = self . io . poll_read ( ) { return Err ( io :: ErrorKind :: WouldBlock . into ( ) ) } match self . io . get_ref ( ) . recv_from ( buf ) { Ok ( n ) => Ok ( n ) , Err ( e ) => { if e . kind ( ) == io :: ErrorKind :: WouldBlock { self . io . need_read ( ) ? ; } Err ( e ) } } }
Receives data from the socket.
Receives data from the socket .
&mut self
buf
&mut [u8]
panics
This function will panic if called outside the context of a future's
task.
This function will panic if called outside the context of a future ' s task .