pub struct UdpSocket(/* private fields */);Expand description
A UDP socket.
Implementations§
Source§impl UdpSocket
impl UdpSocket
Sourcepub fn id(&self) -> OsalId
pub fn id(&self) -> OsalId
Returns the OSAL id for this socket, suitable for passing
to OS_SelectMultiple via the runtime reactor.
Sourcepub fn bind(addr: SocketAddr) -> Result<UdpSocket>
pub fn bind(addr: SocketAddr) -> Result<UdpSocket>
Creates a new UDP socket bound to the specified address.
Sourcepub fn recv_from<'a>(
&self,
buf: &'a mut [u8],
timeout: Timeout,
) -> Result<(usize, SocketAddr)>
pub fn recv_from<'a>( &self, buf: &'a mut [u8], timeout: Timeout, ) -> Result<(usize, SocketAddr)>
Receives a single datagram message on the socket.
Sourcepub fn send_to(&self, buf: &[u8], target: &SocketAddr) -> Result<usize>
pub fn send_to(&self, buf: &[u8], target: &SocketAddr) -> Result<usize>
Sends data on the socket to the given address.
Sourcepub fn recv_from_abs<'a>(
&self,
buf: &'a mut [u8],
abstime: OsTime,
) -> Result<(usize, SocketAddr)>
pub fn recv_from_abs<'a>( &self, buf: &'a mut [u8], abstime: OsTime, ) -> Result<(usize, SocketAddr)>
Receives a datagram with an absolute timeout.
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 UnsafeUnpin for UdpSocket
impl UnwindSafe for UdpSocket
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