PHP 8.3.4 Released!

stream_socket_get_name

(PHP 5, PHP 7, PHP 8)

stream_socket_get_nameローカルまたはリモートのソケットの名前を取得する

説明

stream_socket_get_name(resource $socket, bool $remote): string|false

指定したソケット接続のローカルまたはリモートでの名前を返します。

パラメータ

socket

名前を取得したいソケット。

remote

true に設定するとリモートでのソケットの名前を返し、 false に設定するとローカルでのソケットの名前を返します。

戻り値

ソケットの名前を返します。 失敗した場合に false を返します

参考

add a note

User Contributed Notes 1 note

up
4
recycling dot sp dot am at gmail dot com
13 years ago
Surprisingly, on my Linux system, when connected to a localhost service using IPV4, stream_get_socket_name returns ::1 as the peer or local address. One would expect to get localhost or 127.0.0.1 but the ::1 IPV6 localhost is returned instead.
To Top