Struct cobalt::UdpSocket
[−]
[src]
pub struct UdpSocket { /* fields omitted */ }
Non-blocking abstraction over a UDP socket.
Trait Implementations
impl Socket for UdpSocket
[src]
fn new<T: ToSocketAddrs>(
address: T,
max_packet_size: usize
) -> Result<Self, Error>
address: T,
max_packet_size: usize
) -> Result<Self, Error>
Tries to create a new UDP socket by binding to the specified address.
fn try_recv(&mut self) -> Result<(SocketAddr, Vec<u8>), TryRecvError>
Attempts to return a incoming packet on this socket without blocking.
fn send_to(&mut self, data: &[u8], addr: SocketAddr) -> Result<usize, Error>
Send data on the socket to the given address. On success, returns the number of bytes written.
fn local_addr(&self) -> Result<SocketAddr, Error>
Returns the socket address of the underlying net::UdpSocket
.