September 2001
Intermediate to advanced
768 pages
32h 45m
English
mixed getservbyname(string service_name, string protocol_type)
| service_name | Service name |
| protocol_type | Protocol name; either tcp or udp |
Gets the port number for a service.
Returns:
Port number; FALSE on error
Description:
getservbyname() fetches the port number for the given service running under the given protocol, as defined in your system’s /etc/services or c:\windows\services file. If the protocol is not recognized, the function returns FALSE.
Availability:
UNIX, Windows
Version:
4.0b4+
See also:
getservbyport()
Example:
<?php $protocol = 'tcp'; $service = 'http'; echo "The $service service listens on port ", getservbyname($service, $protocol), ' by default.'; ?> ... |
Read now
Unlock full access