Function getprotobynumber
Get protocol information from protocol number.
struct protoent {
const char * p_name; // official protocol name
const char * * p_aliases; // alias list (will be NULL)
short p_proto; // protocol number
short fill; // reserved
const char * alias; // extended part for actual string
};
struct protent * getprotobynumber(int number);
ParametersnumberNumber of protocol to query (e.g. 6 for TCP, 17 for UDP, 2 for IGMP, etc).
return valueReturns a pointer to a protent structure if successful, otherwise NULL. If an error occurred, call xn_getlasterror and xn_geterror_string to return the error value. Section Error Codes further describes each error. Possible values for this function are:
Value |
Meaning |
ENODATA |
The DNS server could not resolve the protocol name. |
ENOTINITIALIZED |
RTIP-32 has not been initialized (xn_rtip_init has not been called). |
Socket API
Function getprotobyname
Function getservbyname
|