Trait udp_connector::Socket

source ·
pub trait Socket {
    fn recv_from(&mut self, buffer: &mut [u8]) -> Result<(usize, SocketAddr)>;
    fn local_addr(&self) -> SocketAddr;
    fn send_to(&mut self, buffer: &[u8], target: SocketAddr) -> Result<()>;
}
Expand description

A generic trait over a socket. This is automatically implemented for UdpSocket but can be implemented for your own connector as well.

Required Methods

Receive data from any remote, returning the amount of bytes read, and the SocketAddr that the data was received from

The local SocketAddr we’re listening on

Send data to the given SocketAddr

Implementations on Foreign Types

Implementors