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
stream_socket_get_name() retourne le nom du socket
local ou distant pour la connexion socket
.
socket
Le socket dont il faut lire le nom.
remote
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, ou false
si une erreur survient.
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.