Skip to content

Latest commit

 

History

History
203 lines (169 loc) · 5.44 KB

nf-winsock2-getprotobyname.md

File metadata and controls

203 lines (169 loc) · 5.44 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:winsock2.getprotobyname
getprotobyname function (winsock2.h)
The getprotobyname function (winsock2.h) retrieves the protocol information corresponding to a protocol name.
_win32_getprotobyname_2
getprotobyname
getprotobyname function [Winsock]
winsock.getprotobyname_2
winsock/getprotobyname
winsock\getprotobyname_2.htm
WinSock
00669525-d477-4607-beaa-61ef5a8dbd4f
08/03/2022
_win32_getprotobyname_2, getprotobyname, getprotobyname function [Winsock], winsock.getprotobyname_2, winsock/getprotobyname
winsock2.h
Winsock2.h
Windows
Windows 8.1, Windows Vista [desktop apps \| UWP apps]
Windows Server 2003 [desktop apps \| UWP apps]
Ws2_32.lib
Ws2_32.dll
Windows
19H1
getprotobyname
winsock2/getprotobyname
c++
APIRef
kbSyntax
DllExport
Ws2_32.dll
getprotobyname

getprotobyname function

-description

The getprotobyname function retrieves the protocol information corresponding to a protocol name.

-parameters

-param name [in]

Pointer to a null-terminated protocol name.

-returns

If no error occurs, getprotobyname returns a pointer to the protoent. Otherwise, it returns a null pointer and a specific error number can be retrieved by calling WSAGetLastError.

Error code Meaning
WSANOTINITIALISED
A successful WSAStartup call must occur before using this function.
WSAENETDOWN
The network subsystem has failed.
WSAHOST_NOT_FOUND
Authoritative answer protocol not found.
WSATRY_AGAIN
A nonauthoritative protocol not found, or server failure.
WSANO_RECOVERY
Nonrecoverable errors, the protocols database is not accessible.
WSANO_DATA
Valid name, no data record of requested type.
WSAEINPROGRESS
A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.
WSAEFAULT
The name parameter is not a valid part of the user address space.
WSAEINTR
A blocking Windows Socket 1.1 call was canceled through WSACancelBlockingCall.

-remarks

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.

-see-also

WSAAsyncGetProtoByName

Winsock Functions

Winsock Reference

getprotobynumber