ext-swooleis supported until v4.7.1, use
ext-openswoole>= v4.7.1. Latest version:
pecl install openswoole-4.9.1
<?php Swoole\Coroutine\Client->getsockname(): array|false
Returns an array, showing its host and port that is being used by the socket.
Get the local socket name of the connection. Returns the host and port. You must be connected before using this method.
<?php var_dump($client->getSockName()); ... // Output [ 'host' => '127.0.0.1', 'port' => 53652, ]