Trait miow::net::UdpSocketExt[][src]

pub trait UdpSocketExt {
    unsafe fn recv_from_overlapped(
        &self,
        buf: &mut [u8],
        addr: *mut SocketAddrBuf,
        overlapped: *mut OVERLAPPED
    ) -> Result<Option<usize>>;
unsafe fn recv_overlapped(
        &self,
        buf: &mut [u8],
        overlapped: *mut OVERLAPPED
    ) -> Result<Option<usize>>;
unsafe fn send_to_overlapped(
        &self,
        buf: &[u8],
        addr: &SocketAddr,
        overlapped: *mut OVERLAPPED
    ) -> Result<Option<usize>>;
unsafe fn send_overlapped(
        &self,
        buf: &[u8],
        overlapped: *mut OVERLAPPED
    ) -> Result<Option<usize>>;
unsafe fn result(&self, overlapped: *mut OVERLAPPED) -> Result<(usize, u32)>; }
Expand description

Additional methods for the UdpSocket type in the standard library.

Required methods

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(Some(n)) is returned where n is the number of bytes that were read. If the operation returns an error indicating that the I/O is currently pending, Ok(None) 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.

Execute an overlapped receive I/O operation on this UDP socket.

This function will issue an overlapped I/O read (via WSARecv) 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(Some(n)) is returned where n is the number of bytes that were read. If the operation returns an error indicating that the I/O is currently pending, Ok(None) 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, 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.

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(Some(n0) is returned where n byte were written. If the operation returns an error indicating that the I/O is currently pending, Ok(None) 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.

Execute an overlapped send I/O operation on this UDP socket.

This function will issue an overlapped I/O write (via WSASend) on this socket to the address it was previously connected to. 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(Some(n0) is returned where n byte were written. If the operation returns an error indicating that the I/O is currently pending, Ok(None) 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.

Calls the GetOverlappedResult function to get the result of an overlapped operation for this handle.

This function takes the OVERLAPPED argument which must have been used to initiate an overlapped I/O operation, and returns either the successful number of bytes transferred during the operation or an error if one occurred, along with the results of the lpFlags parameter of the relevant operation, if applicable.

Unsafety

This function is unsafe as overlapped must have previously been used to execute an operation for this handle, and it must also be a valid pointer to an OVERLAPPED instance.

Panics

This function will panic

Implementations on Foreign Types

Implementors