PHP 8.1.28 Released!

getservbyname

(PHP 4, PHP 5, PHP 7, PHP 8)

getservbyname Ottiene il numero di porta associato ad un servizio Internet e ad un protocollo

Descrizione

getservbyname(string $servizio, string $protocollo): int

getservbyname() restituisce la porta Internet corrispondente a servizio per il protocollo specificato come in /etc/services. protocollo può essere sia "tcp" che "udp" (scritti in minuscolo). Restituisce false se service o protocol non sono trovati.

Example #1 Esempio di uso di getservbyname()

<?php
$services
= array('http', 'ftp', 'ssh', 'telnet', 'imap',
'smtp', 'nicname', 'gopher', 'finger', 'pop3', 'www');

foreach (
$services as $service) {
$port = getservbyname($service, 'tcp');
echo
$service . ": " . $port . "<br />\n";
}
?>

Per avere la lista completa dei numeri di porta vedere: http://www.iana.org/assignments/port-numbers.

Vedere anche: getservbyport().

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top