This topic describes the WSAEnumProtocols function, which retrieves information about available Windows Sockets protocols.
int WSAEnumProtocols(
LPINT lpiProtocols,
LPWSAPROTOCOL_INFO lpProtocolBuffer,
LPDWORD lpdwBufferLength
);
Parameter | Description |
---|---|
lpiProtocols |
A pointer to an array of integers that specifies which protocols to enumerate. Each integer should be an appropriate protocol identifier, such as AF_INET or AF_UNSPEC . If this parameter is NULL , WSAEnumProtocols retrieves information for all available protocols.
|
lpProtocolBuffer |
A pointer to a buffer that will receive an array of WSAPROTOCOL_INFO structures. Each structure contains detailed information about a Windows Sockets protocol.
|
lpdwBufferLength |
On input, a pointer to a DWORD that specifies the size, in bytes, of the buffer pointed to by lpProtocolBuffer .
On output, if the buffer is too small, this parameter is updated with the required buffer size in bytes. |
Value | Description |
---|---|
On success | The number of WSAPROTOCOL_INFO structures returned in lpProtocolBuffer . |
On failure | SOCKET_ERROR (-1). A specific error code can be retrieved by calling WSAGetLastError . |
The WSAEnumProtocols function is used to retrieve information about the Windows Sockets protocols installed on the system. This information includes details like the address family, socket type, protocol, and required catalog entry. This function is essential for applications that need to discover and select appropriate network protocols for their communication needs.
The WSAPROTOCOL_INFO
structure provides comprehensive information about each protocol, allowing developers to make informed decisions about which protocols to use. The function can be called twice: once to determine the required buffer size and again to retrieve the actual protocol information.
Component | Value |
---|---|
Minimum supported client | Windows 2000 Professional |
Minimum supported server | Windows 2000 Server |
Header | winsock2.h |
Library | Ws2_32.lib |
DLL | Ws2_32.dll |