[−][src]Struct cap_async_std::net::UdpSocket
A UDP socket.
This corresponds to async_std::net::UdpSocket
.
Note that this UdpSocket
has no bind
, connect
, or send_to
methods. To
create a UdpSocket
bound to an address or to send a message to an address,
you must first obtain a Catalog
permitting the address, and then call
Catalog::bind_udp_socket
, or Catalog::connect_udp_socket
, or
Catalog::send_to_udp_socket_addr
.
Implementations
impl UdpSocket
[src]
pub fn from_std(std: UdpSocket) -> Self
[src]
Constructs a new instance of Self
from the given async_std::net::UdpSocket
.
pub async fn recv_from<'_, '_>(
&'_ self,
buf: &'_ mut [u8]
) -> Result<(usize, SocketAddr)>
[src]
&'_ self,
buf: &'_ mut [u8]
) -> Result<(usize, SocketAddr)>
Receives a single datagram message on the socket.
This corresponds to async_std::net::UdpSocket::recv_from
.
pub fn peer_addr(&self) -> Result<SocketAddr>
[src]
Returns the socket address of the remote peer this socket was connected to.
This corresponds to async_std::net::UdpSocket::peer_addr
.
pub fn local_addr(&self) -> Result<SocketAddr>
[src]
Returns the socket address that this socket was created from.
This corresponds to async_std::net::UdpSocket::local_addr
.
pub fn set_broadcast(&self, broadcast: bool) -> Result<()>
[src]
Sets the value of the SO_BROADCAST
option for this socket.
This corresponds to async_std::net::UdpSocket::set_broadcast
.
pub fn broadcast(&self) -> Result<bool>
[src]
Gets the value of the SO_BROADCAST
option for this socket.
This corresponds to async_std::net::UdpSocket::broadcast
.
pub fn set_multicast_loop_v4(&self, multicast_loop_v4: bool) -> Result<()>
[src]
Sets the value of the IP_MULTICAST_LOOP
option for this socket.
This corresponds to async_std::net::UdpSocket::set_multicast_loop_v4
.
pub fn multicast_loop_v4(&self) -> Result<bool>
[src]
Gets the value of the IP_MULTICAST_LOOP
option for this socket.
This corresponds to async_std::net::UdpSocket::multicast_loop_v4
.
pub fn set_multicast_ttl_v4(&self, multicast_ttl_v4: u32) -> Result<()>
[src]
Sets the value of the IP_MULTICAST_TTL
option for this socket.
This corresponds to async_std::net::UdpSocket::set_multicast_ttl_v4
.
pub fn multicast_ttl_v4(&self) -> Result<u32>
[src]
Gets the value of the IP_MULTICAST_TTL
option for this socket.
This corresponds to async_std::net::UdpSocket::multicast_ttl_v4
.
pub fn set_multicast_loop_v6(&self, multicast_loop_v6: bool) -> Result<()>
[src]
Sets the value of the IPV6_MULTICAST_LOOP
option for this socket.
This corresponds to async_std::net::UdpSocket::set_multicast_loop_v6
.
pub fn multicast_loop_v6(&self) -> Result<bool>
[src]
Gets the value of the IPV6_MULTICAST_LOOP
option for this socket.
This corresponds to async_std::net::UdpSocket::multicast_loop_v6
.
pub fn set_ttl(&self, ttl: u32) -> Result<()>
[src]
Sets the value for the IP_TTL
option on this socket.
This corresponds to async_std::net::UdpSocket::set_ttl
.
pub fn ttl(&self) -> Result<u32>
[src]
Gets the value of the IP_TTL
option for this socket.
This corresponds to async_std::net::UdpSocket::ttl
.
pub fn join_multicast_v4(
&self,
multiaddr: Ipv4Addr,
interface: Ipv4Addr
) -> Result<()>
[src]
&self,
multiaddr: Ipv4Addr,
interface: Ipv4Addr
) -> Result<()>
Executes an operation of the IP_ADD_MEMBERSHIP
type.
This corresponds to async_std::net::UdpSocket::join_multicast_v4
.
pub fn join_multicast_v6(
&self,
multiaddr: &Ipv6Addr,
interface: u32
) -> Result<()>
[src]
&self,
multiaddr: &Ipv6Addr,
interface: u32
) -> Result<()>
Executes an operation of the IPV6_ADD_MEMBERSHIP
type.
This corresponds to async_std::net::UdpSocket::join_multicast_v6
.
pub fn leave_multicast_v4(
&self,
multiaddr: Ipv4Addr,
interface: Ipv4Addr
) -> Result<()>
[src]
&self,
multiaddr: Ipv4Addr,
interface: Ipv4Addr
) -> Result<()>
Executes an operation of the IP_DROP_MEMBERSHIP
type.
This corresponds to async_std::net::UdpSocket::leave_multicast_v4
.
pub fn leave_multicast_v6(
&self,
multiaddr: &Ipv6Addr,
interface: u32
) -> Result<()>
[src]
&self,
multiaddr: &Ipv6Addr,
interface: u32
) -> Result<()>
Executes an operation of the IPV6_DROP_MEMBERSHIP
type.
This corresponds to async_std::net::UdpSocket::leave_multicast_v6
.
pub async fn send<'_, '_>(&'_ self, buf: &'_ [u8]) -> Result<usize>
[src]
Sends data on the socket to the remote address to which it is connected.
This corresponds to async_std::net::UdpSocket::send
.
pub async fn recv<'_, '_>(&'_ self, buf: &'_ mut [u8]) -> Result<usize>
[src]
Receives a single datagram message on the socket from the remote address to which it is connected.
This corresponds to async_std::net::UdpSocket::recv
.
Trait Implementations
impl AsRawFd for UdpSocket
[src]
impl FromRawFd for UdpSocket
[src]
unsafe fn from_raw_fd(fd: RawFd) -> Self
[src]
impl IntoRawFd for UdpSocket
[src]
fn into_raw_fd(self) -> RawFd
[src]
Auto Trait Implementations
impl RefUnwindSafe for UdpSocket
impl Send for UdpSocket
impl Sync for UdpSocket
impl Unpin for UdpSocket
impl UnwindSafe for UdpSocket
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,