Trait cobalt::Socket
[−]
[src]
pub trait Socket: Debug { fn new<T: ToSocketAddrs>(_: T, _: usize) -> Result<Self, Error>
where
Self: Sized; fn try_recv(&mut self) -> Result<(SocketAddr, Vec<u8>), TryRecvError>; fn send_to(&mut self, data: &[u8], addr: SocketAddr) -> Result<usize, Error>; fn local_addr(&self) -> Result<SocketAddr, Error>; }
Trait describing a non-blocking low latency socket.
Required Methods
fn new<T: ToSocketAddrs>(_: T, _: usize) -> Result<Self, Error> where
Self: Sized,
Self: Sized,
Method that tries to bind a new socket at the specified address.
fn try_recv(&mut self) -> Result<(SocketAddr, Vec<u8>), TryRecvError>
Method that attempts to return a incoming packet on this socket without blocking.
fn send_to(&mut self, data: &[u8], addr: SocketAddr) -> Result<usize, Error>
Method sending data on the socket to the given address. On success, returns the number of bytes written.
fn local_addr(&self) -> Result<SocketAddr, Error>
Method returning the address of the actual, underlying socket.
Implementors
impl Socket for UdpSocket