Using getservbyport() : getservbyport « Date « PHP






Using getservbyport()

 
<?php
    $port = 80;
    $service = getservbyport($port, 'tcp');
    if($service === false) {

        die("Could not find a service running on $port\n");
    } else {
        echo "The '$service' service runs on port $port\n";
    }
?>
  
  








Related examples in the same category

1.getservbyport.php