pub struct AsyncUdpSocket { /* private fields */ }Expand description
Asynchronous UDP socket built on top of Tokio.
Implementations§
Source§impl AsyncUdpSocket
impl AsyncUdpSocket
Sourcepub fn from_config(config: &UdpConfig) -> Result<Self>
pub fn from_config(config: &UdpConfig) -> Result<Self>
Create an asynchronous UDP socket from the given configuration.
Sourcepub fn new(domain: Domain, sock_type: SockType) -> Result<Self>
pub fn new(domain: Domain, sock_type: SockType) -> Result<Self>
Create a socket of arbitrary type (DGRAM or RAW).
Sourcepub async fn send_to(&self, buf: &[u8], target: SocketAddr) -> Result<usize>
pub async fn send_to(&self, buf: &[u8], target: SocketAddr) -> Result<usize>
Send data asynchronously.
Sourcepub async fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
pub async fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
Receive data asynchronously.
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Retrieve the local socket address.
pub fn into_tokio_socket(self) -> Result<UdpSocket>
Sourcepub fn from_std_socket(socket: StdUdpSocket) -> Result<Self>
pub fn from_std_socket(socket: StdUdpSocket) -> Result<Self>
Construct from a standard UDP socket.
Sourcepub fn into_std_socket(self) -> Result<StdUdpSocket>
pub fn into_std_socket(self) -> Result<StdUdpSocket>
Convert into a standard UDP socket.
Sourcepub fn set_broadcast(&self, on: bool) -> Result<()>
pub fn set_broadcast(&self, on: bool) -> Result<()>
Set broadcast mode.
pub fn as_raw_fd(&self) -> RawFd
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AsyncUdpSocket
impl RefUnwindSafe for AsyncUdpSocket
impl Send for AsyncUdpSocket
impl Sync for AsyncUdpSocket
impl Unpin for AsyncUdpSocket
impl UnsafeUnpin for AsyncUdpSocket
impl UnwindSafe for AsyncUdpSocket
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more