getprotobynumber()

The getprotobynumber() call searches the hlq.ETC.PROTO data set for the specified protocol number.

The getprotobynumber() call returns a pointer to a protoent structure for the network protocol specified on the call.

#include <manifest.h>
#include <netdb.h>
struct protoent *getprotobynumber(int proto)
Parameter
Description
proto
Protocol number
The protoent structure is defined in the NETDB.H header file and contains the following elements:
Element
Description
p_name
The official name of the protocol
p_aliases
An array, terminated with a NULL pointer, of alternative names for the protocol
p_proto
The protocol number

Return values

The return value points to static data that is overwritten by subsequent calls. A pointer to a protoent structure indicates success. A NULL pointer indicates an error or end-of-file. When a NULL pointer or 0 is returned, the value of errno is indeterminate, and therefore, the output from a tcperror() call cannot be validated.

Related calls

endprotoent(), getprotobyname(), getprotoent(), setprotoent()