Current Location: Home> Function Categories> getservbyname

getservbyname

Get the port number associated with Internet services and protocols
Name:getservbyname
Category:Network
Programming Language:php
One-line Description:Returns the port number for the given Internet service and protocol.

Definition and usage

getservbyname() function returns the port number of the given Internet service and protocol.

Example

An example of getservbyname() :

 <?php
$portnum = getservbyname ( "http" , "tcp" ) ;
echo $portnum ;
?>

grammar

 getservbyname ( service , protocol )

Parameter value

parameter describe
service Required. Specify the Internet service name (such as "http").
protocol Required. Specify a protocol name (such as "tcp" or "udp").
Similar Functions