getservbyname
Get the port number associated with Internet services and protocols
getservbyname() function returns the port number of the given Internet service and protocol.
An example of getservbyname() :
<?php $portnum = getservbyname ( "http" , "tcp" ) ; echo $portnum ; ?>
getservbyname ( service , protocol )
| parameter | describe |
|---|---|
| service | Required. Specify the Internet service name (such as "http"). |
| protocol | Required. Specify a protocol name (such as "tcp" or "udp"). |