[][src]Trait udp_sas_mio::UdpSas

pub trait UdpSas: Sized {
    pub fn bind_sas(addr: SocketAddr) -> Result<Self>;
pub fn send_sas(
        &self,
        buf: &[u8],
        target: &SocketAddr,
        local: &IpAddr
    ) -> Result<usize>;
pub fn recv_sas(
        &self,
        buf: &mut [u8]
    ) -> Result<(usize, SocketAddr, IpAddr)>; }

An extension trait to support source address selection in mio::net::UdpSocket

See module level documentation for more details.

Required methods

pub fn bind_sas(addr: SocketAddr) -> Result<Self>[src]

Creates a UDP socket from the given address.

The new socket is configured with the IP_PKTINFO or IPV6_RECVPKTINFO option enabled.

pub fn send_sas(
    &self,
    buf: &[u8],
    target: &SocketAddr,
    local: &IpAddr
) -> Result<usize>
[src]

Sends a datagram to the given target address and use the local address as its source.

On success, returns the number of bytes written.

pub fn recv_sas(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr, IpAddr)>[src]

Receive a datagram

On success, returns a tuple (nb, source, local) containing the number of bytes read, the source socket address (peer address), and the destination ip address (local address).

Loading content...

Implementations on Foreign Types

impl UdpSas for UdpSocket[src]

Loading content...

Implementors

Loading content...