Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

getservbyname(3) [php man page]

GETSERVBYNAME(3)							 1							  GETSERVBYNAME(3)

getservbyname - Get port number associated with an Internet service and protocol

SYNOPSIS
int getservbyname (string $service, string $protocol) DESCRIPTION
getservbyname(3) returns the Internet port which corresponds to $service for the specified $protocol as per /etc/services. PARAMETERS
o $service - The Internet service name, as a string. o $protocol -$protocol is either "tcp" or "udp" (in lowercase). RETURN VALUES
Returns the port number, or FALSE if $service or $protocol is not found. EXAMPLES
Example #1 getservbyname(3) example <?php $services = array('http', 'ftp', 'ssh', 'telnet', 'imap', foreach ($services as $service) { $port = getservbyname($service, 'tcp'); echo $service . ": " . $port . "<br /> "; } ?> SEE ALSO
getservbyport(3), http://www.iana.org/assignments/port-numbers for a complete list of port numbers. . PHP Documentation Group GETSERVBYNAME(3)

Check Out this Related Man Page

services(4)							   File Formats 						       services(4)

NAME
services - Internet services and aliases SYNOPSIS
/etc/inet/services /etc/services DESCRIPTION
The services file is a local source of information regarding each service available through the Internet. The services file can be used in conjunction with or instead of other services sources, including the NIS maps "services.byname" and the NIS+ table "services." Programs use the getservbyname(3SOCKET) routines to access this information. The services file contains an entry for each service. Each entry has the form: service-name port/protocol aliases service-name This is the official Internet service name. port/protocol This field is composed of the port number and protocol through which the service is provided, for instance, 512/tcp. aliases This is a list of alternate names by which the service might be requested. Fields can be separated by any number of SPACE and/or TAB characters. A number sign (#) indicates the beginning of a comment; any charac- ters that follow the comment character up to the end of the line are not interpreted by routines which search the file. Service names may contain any printable character other than a field delimiter, a NEWLINE, or a comment character. Any changes to a port assignment do not affect the actual port registration of the service. FILES
/etc/nsswitch.conf configuration file for name-service switch SEE ALSO
getservbyname(3SOCKET), inetd.conf(4), nsswitch.conf(4) NOTES
/etc/inet/services is the official SVR4 name of the services file. The symbolic link /etc/services exists for BSD compatibility. SunOS 5.11 12 Oct 2000 services(4)
Man Page