Swoole\Client->getSocket

4.x is outdated, please check the latest version 22.x


Latest version: pecl install openswoole-22.1.2

Declaration

<?php Swoole\Client->getSocket()

Parameters

Return

Description

Get the Socket. Then you can use socket API on the socket.

Example

<?php
$socket = $client->getSocket();
if (!socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1)) {
    echo 'Unable to set option on socket: '. socket_strerror(socket_last_error()) . PHP_EOL;
}
Last updated on August 31, 2022