Struct tokio::udp::UdpSocket [] [src]

pub struct UdpSocket {
    // some fields omitted
}

A UDP socket.

Methods

impl UdpSocket
[src]

fn bind(addr: &SocketAddr) -> Result<UdpSocket>

Creates a UDP socket from the given address.

fn watch(mio: UdpSocket) -> Result<UdpSocket>

Create and return a new UdpSocket backed by the given Mio UdpSocket.

This turns an existing socket into a Tokio aware socket.

fn local_addr(&self) -> Result<SocketAddr>

Returns the local address of this socket.

fn send_to(&self, buf: &[u8], target: &SocketAddr) -> Result<usize>

Sends data on the socket to the given address. On success, returns the number of bytes written.

fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>

Receives data from the socket. On success, returns the number of bytes read and the address from whence the data came.

Trait Implementations

impl Readiness for UdpSocket
[src]

fn is_readable(&self) -> bool

Returns true if the value is currently readable.

fn is_writable(&self) -> bool

Returns true if the value is currently writable.