pub async fn recv_from(&self, buf: &mut [u8]) -> io::Result<(usize, Address)> {
        let mut recv_buf = vec![0u8; MAXIMUM_UDP_PAYLOAD_SIZE];
        let n = self.socket.recv(&mut recv_buf).await?;

        // Address + Payload
        let mut cur = Cursor::new(&recv_buf[..n]);

        let header = UdpAssociateHeader::read_from(&mut cur).await?;
        let n = cur.read(buf)?;

        Ok((n, header.address))
    }
/// Returns a future that receives a single datagram on the socket. On success, the future resolves to the number of bytes read and the origin.
///
/// The function must be called with valid byte array buf of sufficient size to hold the message bytes.
/// If a message is too long to fit in the supplied buffer, excess bytes may be discarded.
Returns a future that receives a single datagram on the socket. On success, the future resolves to the number of bytes read and the origin.
The function must be called with valid byte array buf of sufficient size to hold the message bytes.
If a message is too long to fit in the supplied buffer, excess bytes may be discarded.
Returns a future that receives a single datagram on the socket . On success the future resolves to the number of bytes read and the origin . The function must be called with valid byte array buf of sufficient size to hold the message bytes . If a message is too long to fit in the supplied buffer excess bytes may be discarded .
pub async fn recv_from(&self, buf: &mut [u8]) -> io::Result<(usize, Address)> {
        let mut recv_buf = vec![0u8; MAXIMUM_UDP_PAYLOAD_SIZE];
        let n = self.socket.recv(&mut recv_buf).await?;
        // Address + Payload
        let mut cur = Cursor::new(&recv_buf[..n]);
        let header = UdpAssociateHeader::read_from(&mut cur).await?;
        let n = cur.read(buf)?;
        Ok((n, header.address))
    }
pub async fn recv_from ( & self , buf : & mut [ u8 ] ) -> io :: Result < ( usize , Address ) > { let mut recv_buf = vec ! [ 0u8 MAXIMUM_UDP_PAYLOAD_SIZE ] ; let n = self . socket . recv ( & mut recv_buf ) . await ? ; // Address + Payload let mut cur = Cursor :: new ( & recv_buf [ .. n ] ) ; let header = UdpAssociateHeader :: read_from ( & mut cur ) . await ? ; let n = cur . read ( buf ) ? ; Ok ( ( n , header . address ) ) }
Returns a future that receives a single datagram on the socket.
Returns a future that receives a single datagram on the socket .
&self
buf
&mut [u8]