getprotobyname function (winsock.h)
The getprotobyname function retrieves the protocol information corresponding to a protocol name.
protoent * getprotobyname( const char *name );
Pointer to a null-terminated protocol name.
|A successful WSAStartup call must occur before using this function.|
|The network subsystem has failed.|
|Authoritative answer protocol not found.|
|A nonauthoritative protocol not found, or server failure.|
|Nonrecoverable errors, the protocols database is not accessible.|
|Valid name, no data record of requested type.|
|A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.|
|The name parameter is not a valid part of the user address space.|
|A blocking Windows Socket 1.1 call was canceled through WSACancelBlockingCall.|
The getprotobyname function returns a pointer to the protoent structure containing the name(s) and protocol number that correspond to the protocol specified in the name parameter. All strings are null-terminated. The protoent structure is allocated by the Windows Sockets library. An application must never attempt to modify this structure or to free any of its components. Furthermore, like hostent, only one copy of this structure is allocated per thread, so the application should copy any information that it needs before issuing any other Windows Sockets function calls.
Windows Phone 8: This function is supported for Windows Phone Store apps on Windows Phone 8 and later.
Windows 8.1 and Windows Server 2012 R2: This function is supported for Windows Store apps on Windows 8.1, Windows Server 2012 R2, and later.
|Minimum supported client||Windows 8.1, Windows Vista [desktop apps | UWP apps]|
|Minimum supported server||Windows Server 2003 [desktop apps | UWP apps]|
|Header||winsock.h (include Winsock2.h)|