Function getservbyname
Get service information from a service name and a protocol name.
struct servent {
const char * s_name; // official name of the service
const char * * s_aliases; // alternative names (will be NULL)
int s_port; // port number in network byte order
const char * s_proto; // name of the protocol
};
struct servent * getservbyname(char * name, char * proto);
ParametersnamePointer to service name (e.g., "echo", "discard", etc).
protoPointer to protocol name (e.g. "tcp", "udp").
return valueReturns a pointer to a servent 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 getprotobynumber
Function getservbyport
|