OpenSwoole\Coroutine\Client->getSockName()

Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5

Declaration

<?php OpenSwoole\Coroutine\Client->getsockname(): array|false

Parameters

None

Return

Returns an array, showing its host and port that is being used by the socket.

Description

Get the local socket name of the connection. Returns the host and port. You must be connected before using this method.

Example

<?php
var_dump($client->getSockName());

...

// Output
[
    'host' => '127.0.0.1', 'port' => 53652,
]
Last updated on September 1, 2022