Trait miow::net::UdpSocketExt
[−]
[src]
pub trait UdpSocketExt { unsafe fn recv_from_overlapped(&self, buf: &mut [u8], addr: &mut SocketAddrBuf, overlapped: &mut Overlapped) -> Result<bool>; unsafe fn send_to_overlapped(&self, buf: &[u8], addr: &SocketAddr, overlapped: &mut Overlapped) -> Result<bool>; }
Additional methods for the UdpSocket
type in the standard library.
Required Methods
unsafe fn recv_from_overlapped(&self, buf: &mut [u8], addr: &mut SocketAddrBuf, overlapped: &mut Overlapped) -> Result<bool>
Execute an overlapped receive I/O operation on this UDP socket.
This function will issue an overlapped I/O read (via WSARecvFrom
) on
this socket. The provided buffer will be filled in when the operation
completes, the source from where the data came from will be written to
addr
, and the given Overlapped
instance is used to track the
overlapped operation.
If the operation succeeds, Ok(true)
is returned. If the operation
returns an error indicating that the I/O is currently pending,
Ok(false)
is returned. Otherwise, the error associated with the
operation is returned and no overlapped operation is enqueued.
The number of bytes read will be returned as part of the completion notification when the I/O finishes.
Unsafety
This function is unsafe because the kernel requires that the buf
,
addr
, and overlapped
pointers are valid until the end of the I/O
operation. The kernel also requires that overlapped
is unique for this
I/O operation and is not in use for any other I/O.
To safely use this function callers must ensure that these two input pointers are valid until the I/O operation is completed, typically via completion ports and waiting to receive the completion notification on the port.
unsafe fn send_to_overlapped(&self, buf: &[u8], addr: &SocketAddr, overlapped: &mut Overlapped) -> Result<bool>
Execute an overlapped send I/O operation on this UDP socket.
This function will issue an overlapped I/O write (via WSASendTo
) on
this socket to the address specified by addr
. The provided buffer will
be written when the operation completes and the given Overlapped
instance is used to track the overlapped operation.
If the operation succeeds, Ok(true)
is returned. If the operation
returns an error indicating that the I/O is currently pending,
Ok(false)
is returned. Otherwise, the error associated with the
operation is returned and no overlapped operation is enqueued.
The number of bytes written will be returned as part of the completion notification when the I/O finishes.
Unsafety
This function is unsafe because the kernel requires that the buf
and
overlapped
pointers are valid until the end of the I/O operation. The
kernel also requires that overlapped
is unique for this I/O operation
and is not in use for any other I/O.
To safely use this function callers must ensure that these two input pointers are valid until the I/O operation is completed, typically via completion ports and waiting to receive the completion notification on the port.
Implementors
impl UdpSocketExt for UdpSocket