pub struct UdpSocket(/* private fields */);Available on crate feature
net only.Expand description
A UDP socket.
After creating a UdpSocket by binding it to a socket address, data can be sent to and
received from any other socket address.
As stated in the User Datagram Protocol’s specification in IETF RFC 768, UDP is an unordered,
unreliable protocol. Refer to TcpListener and TcpStream for async TCP primitives.
This type is an async version of std::net::UdpSocket.
Implementations§
Source§impl UdpSocket
impl UdpSocket
Sourcepub fn as_raw_ptr(&self) -> &dyn DriverUdpSocket
pub fn as_raw_ptr(&self) -> &dyn DriverUdpSocket
Returns inner driver-specific implementation.
Sourcepub async fn bind<L: ToSocketAddrs>(laddrs: L) -> Result<Self>
pub async fn bind<L: ToSocketAddrs>(laddrs: L) -> Result<Self>
Create new udp socket which will be bound to the specified laddrs
pub async fn bind_with<L: ToSocketAddrs>( laddrs: L, driver: &dyn Driver, ) -> Result<Self>
pub unsafe fn from_raw_fd_with(fd: RawFd, driver: &dyn Driver) -> Result<Self>
Available on Unix only.
pub unsafe fn from_raw_fd(fd: RawFd) -> Result<Self>
Available on Unix only.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UdpSocket
impl !RefUnwindSafe for UdpSocket
impl Send for UdpSocket
impl Sync for UdpSocket
impl Unpin for UdpSocket
impl !UnwindSafe for UdpSocket
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)