stream_socket_get_name()

stream_socket_get_name() — Retrieve the name of the local or remote sockets.

Built-in function of PHP 8.5. The manual lists it as available in PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

Signature

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

Parameters

ParameterTypeWhat it takes
$socketresourceThe socket to get the name of.
$remoteboolIf set to true the remote socket name will be returned, if set to false the local socket name will be returned.

Return value

The name of the socket, or false on failure.

Example

The PHP manual ships no example for stream_socket_get_name(); the signature and the parameter table above are the contract.

See also

stream_socket_accept()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page stream_socket_get_name() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.