Trait miow::net::TcpStreamExt [] [src]

pub trait TcpStreamExt {
    unsafe fn read_overlapped(&self,
                              buf: &mut [u8],
                              overlapped: &mut Overlapped)
                              -> Result<bool>; unsafe fn write_overlapped(&self,
                               buf: &[u8],
                               overlapped: &mut Overlapped)
                               -> Result<bool>; unsafe fn connect_overlapped(&self,
                                 addr: &SocketAddr,
                                 overlapped: &mut Overlapped)
                                 -> Result<bool>; fn connect_complete(&self) -> Result<()>; unsafe fn result(&self, overlapped: *mut Overlapped) -> Result<(usize, u32)>; }

Additional methods for the TcpStream type in the standard library.

Required Methods

Execute an overlapped read I/O operation on this TCP stream.

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 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 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 write I/O operation on this TCP stream.

This function will issue an overlapped I/O write (via WSASend) on this socket. 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.

Execute a connection operation for this socket.

For more information about this method, see the TcpBuilderExt::connect_overlapped documentation.

Once a connect_overlapped has finished, this function needs to be called to finish the connect operation.

Currently this just calls setsockopt with SO_UPDATE_CONNECT_CONTEXT to ensure that further functions like getpeername and getsockname work correctly.

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

Implementors