WSAIoctl
WSAIoctl is a Windows Sockets API function used to perform I/O control operations on a socket. It provides a mechanism to query or configure extended options and to obtain information that is not exposed through the standard getsockopt/setsockopt interfaces. WSAIoctl accepts a socket handle, a control code, optional input and output buffers, the sizes of those buffers, and a place to receive the number of bytes returned. It also supports overlapped (asynchronous) operation via a WSAOVERLAPPED structure and an optional completion routine.
int WSAIoctl(SOCKET s, DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer, LPVOID lpvOutBuffer, DWORD cbOutBuffer, LPDWORD lpcbBytesReturned, LPWSAOVERLAPPED
Return value is zero on success and SOCKET_ERROR on failure. When an error occurs, extended error information
Common uses include enabling or querying advanced socket capabilities, obtaining network topology or interface information, and
- Include Winsock2.h and typically Ws2tcpip.h for some IP-related controls.
- WSAIoctl is complementary to, and more general than, ioctlsocket, and is aimed at advanced scenarios in
See also: ioctlsocket, getsockopt, setsockopt, WSAGetLastError, WSAOVERLAPPED, Ws2_32.lib.