Home |
Function getservbyname |
Function getservbynameGet 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:
|