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.
(PHP 5, PHP 7, PHP 8)
stream_socket_get_name — Lit le nom de la socket locale ou distante
$handle
, bool $want_peer
): string
stream_socket_get_name() retourne le nom du socket
local ou distant pour la connexion handle
.
handle
Le socket dont il faut lire le nom.
want_peer
Si ce paramètre vaut true
le nom du socket remote
(distant) sera retourné, et si ce paramètre vaut false
le socket local
(local) sera retourné.
Le nom du socket.
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.