Using getprotobyname() : getprotobyname « Network « PHP






Using getprotobyname()

 
<?php
    $proto = "smp";
    $proto_num = getprotobyname($proto);
    if($proto_num == -1) {
        die("Could not find protocol '$proto'\n");
    } else {
        echo "The '$proto' protocol has an ID of $proto_num\n";
    }
?>
  
  








Related examples in the same category