WSAIoctl
WSAIoctl performs a protocol-specific I/O control action on the socket in any state.
Syntax
int WSAIoctl( SOCKET s, DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer, LPVOID lpvOutBuffer, DWORD cbOutBuffer, LPDWORD lpcbBytesReturned, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine );
Parameters
s
Open socket descriptor.
dwIoControlCode
The following commands are currently supported:
Command | Description |
---|---|
FIONBIO |
This IOCTL enables or disables nonblocking mode of a socket. By default, a socket is created in blocking mode. |
FIONREAD |
This IOCTL can be used with UDP and TCP sockets to determine the minimum amount of data queued in the socket receive queue that can be read with the next call to Recv or RecvFrom without blocking. More data might be available by the time Recv or RecvFrom is actually called, but at least as much as returned by the IOCTL is available. The argp parameter must point to the address of an unsigned long value. For a UDP socket, the function returns the amount of data that can be read by the next call to Recv or RecvFrom, which is the data in the UDP datagram. For a TCP socket, the amount of data in the TCP segment at the head of the socket receive queue is returned. Note: The FIONREAD command is not supported under RTX 8.1 and earlier |
SIOCATMARK |
This IOCTL may be used by an application to locate the urgent byte (in any) in the incoming data stream (that is, the byte that the sending end sent with the MSG_OOB flag). This IOCTL returns True if the next byte to be read from the read buffer is the out-of-band mark, that is:
|
lpvInBuffer
A pointer to the input buffer.
cbInBuffer
The size, in bytes, of the input buffer.
lpvOutBuffer
A pointer to the output buffer.
cbOutBuffer
The size, in bytes, of the output buffer.
lpcbBytesReturned
Ignored. A pointer to actual number of bytes of output.
lpOverlapped
Ignored. A pointer to a WSAOVERLAPPED structure (ignored for non-overlapped sockets).
lpCompletionRoutine
Ignored. A pointer to the completion routine called when the operation has been completed (ignored for non-overlapped sockets).
Return Value
A positive value if the function succeeds, SOCKET_ERROR if the function fails
Use WSAGetLastError to retrieve a specific error code.
Requirements
Minimum Supported Version | RTX64 2013 |
Header | Winsock2.h |
Library | RtTcpip.lib |