PHP getservbyname()関数
例
getservbyname()の例:
<?php
$portnum = getservbyname("http", "tcp");
echo $portnum;
?>
定義と使用法
getservbyname()関数は、特定のインターネットサービスとプロトコルのポート番号を返します。
構文
getservbyname(service, protocol)
パラメータ値
Parameter | Description |
---|---|
service | Required. Specifies the Internet service name (like "http") |
protocol | Required. Specifies a protocol name (like "tcp" or "udp") |
技術的な詳細
戻り値: | 成功した場合のポート番号。失敗するとFALSE |
---|---|
PHPバージョン: | 4.0以降 |
❮PHPネットワークリファレンス