Like the previous post of palands, the protcol tcp must be in lower case, either quoted or unquoted..
Example:
$value=getservbyport(31337, "tcp");
Uppercase will not work.
getservbyport
(PHP 4, PHP 5)
getservbyport — ポートおよびプロトコルに対応するインターネットサービスを得る
説明
string getservbyport
( int
$port
, string $protocol
)
getservbyport() は、
/etc/services に基づき
指定したプロトコル protocol
に関してポート port
に関連するインターネットサービスを返します。
パラメータ
-
port -
ポート番号。
-
protocol -
protocolは "tcp" あるいは "udp" (小文字) のいずれかです。
返り値
インターネットサービス名を文字列で返します。
q9603062 at topaz dot cqu dot edu dot au
16-Jan-2001 03:28
paland at stetson dot edu
29-Nov-2000 05:00
Example:
<?php $value = getservbyport(137, "udp"); ?>
The same goes for getservbyname()
