Net_Portscan::getPort() – port number of a service


require_once 'Net/Portscan.php';

integer Net_Portscan::getPort ( string $service , string $protocol = 'tcp' )


This function returns the port which corresponds to service for the specified protocol as per /etc/services.


  • string $service - name of the service to check

  • string $protocol - access protocol

Return value

integer - port number of the service


This function can be called statically.

The port number is retrieved from the machine where Net_Portscan is executed, not from the remote host, which you possibly used in Net_Portscan::checkPort().

check for available services (Previous) name of the service (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.