Struct libp2p_rs::runtime::net::UdpSocket[][src]

pub struct UdpSocket(_);

Implementations

impl UdpSocket[src]

pub async fn bind<A>(addrs: A) -> Result<UdpSocket, Error> where
    A: ToSocketAddrs, 
[src]

Creates a UDP socket from the given address.

pub fn peer_addr(&self) -> Result<SocketAddr, Error>[src]

Returns the peer address that this listener is connected to.

pub fn local_addr(&self) -> Result<SocketAddr, Error>[src]

Returns the local address that this listener is bound to.

pub async fn send_to<A>(
    &'_ self,
    buf: &'_ [u8],
    addrs: A
) -> Result<usize, Error> where
    A: ToSocketAddrs, 
[src]

Sends data on the socket to the given address.

pub async fn recv_from(
    &'_ self,
    buf: &'_ mut [u8]
) -> Result<(usize, SocketAddr), Error>
[src]

Receives data from the socket.

pub async fn peek_from(
    &'_ self,
    buf: &'_ mut [u8]
) -> Result<(usize, SocketAddr), Error>
[src]

Receives data from socket without removing it from the queue.

pub async fn connect<A>(&'_ self, addrs: A) -> Result<(), Error> where
    A: ToSocketAddrs, 
[src]

Connects the UDP socket to a remote address.

pub async fn send(&'_ self, buf: &'_ [u8]) -> Result<usize, Error>[src]

Sends data on the socket to the remote address to which it is connected.

pub async fn recv(&'_ self, buf: &'_ mut [u8]) -> Result<usize, Error>[src]

Receives data from the socket.

pub async fn peek(&'_ self, buf: &'_ mut [u8]) -> Result<usize, Error>[src]

Receives data from the socket without removing it from the queue.

pub fn broadcast(&self) -> Result<bool, Error>[src]

Gets the value of the SO_BROADCAST option for this socket.

pub fn set_broadcast(&self, on: bool) -> Result<(), Error>[src]

Sets the value of the SO_BROADCAST option for this socket.

pub fn multicast_loop_v4(&self) -> Result<bool, Error>[src]

Gets the value of the IP_MULTICAST_LOOP option for this socket.

pub fn set_multicast_loop_v4(&self, on: bool) -> Result<(), Error>[src]

Sets the value of the IP_MULTICAST_LOOP option for this socket.

pub fn multicast_ttl_v4(&self) -> Result<u32, Error>[src]

Gets the value of the IP_MULTICAST_TTL option for this socket.

pub fn set_multicast_ttl_v4(&self, ttl: u32) -> Result<(), Error>[src]

Sets the value of the IP_MULTICAST_TTL option for this socket.

pub fn multicast_loop_v6(&self) -> Result<bool, Error>[src]

Gets the value of the IPV6_MULTICAST_LOOP option for this socket.

pub fn set_multicast_loop_v6(&self, on: bool) -> Result<(), Error>[src]

Sets the value of the IPV6_MULTICAST_LOOP option for this socket.

pub fn ttl(&self) -> Result<u32, Error>[src]

Gets the value of the IP_TTL option for this socket.

pub fn set_ttl(&self, ttl: u32) -> Result<(), Error>[src]

Sets the value for the IP_TTL option on this socket.

pub fn join_multicast_v4(
    &self,
    multiaddr: Ipv4Addr,
    interface: Ipv4Addr
) -> Result<(), Error>
[src]

Executes an operation of the IP_ADD_MEMBERSHIP type.

pub fn join_multicast_v6(
    &self,
    multiaddr: &Ipv6Addr,
    interface: u32
) -> Result<(), Error>
[src]

Executes an operation of the IPV6_ADD_MEMBERSHIP type.

pub fn leave_multicast_v4(
    &self,
    multiaddr: Ipv4Addr,
    interface: Ipv4Addr
) -> Result<(), Error>
[src]

Executes an operation of the IP_DROP_MEMBERSHIP type.

pub fn leave_multicast_v6(
    &self,
    multiaddr: &Ipv6Addr,
    interface: u32
) -> Result<(), Error>
[src]

Executes an operation of the IPV6_DROP_MEMBERSHIP type.

Trait Implementations

impl Debug for UdpSocket[src]

impl From<UdpSocket> for UdpSocket[src]

pub fn from(socket: UdpSocket) -> UdpSocket[src]

Converts a std::net::UdpSocket into its asynchronous equivalent.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,