Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

getprotobynumber function

The getprotobynumber function retrieves protocol information corresponding to a protocol number.

Syntax


struct PROTOENT* FAR getprotobynumber(
  _In_  int number
);

Parameters

number [in]

Protocol number, in host byte order.

Return value

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

Error codeMeaning
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.

WSAEINTR

A blocking Windows Socket 1.1 call was canceled through WSACancelBlockingCall.

 

Remarks

This getprotobynumber function returns a pointer to the protoent structure as previously described in getprotobyname. The contents of the structure correspond to the given protocol number.

The pointer that is returned points to the structure allocated by Windows Sockets. The application must never attempt to modify this structure or to free any of its components. Furthermore, 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 API is supported.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winsock2.h

Library

Ws2_32.lib

DLL

Ws2_32.dll

See also

Winsock Reference
Winsock Functions
getprotobyname
WSAAsyncGetProtoByNumber

 

 

Community Additions

Show:
© 2014 Microsoft