Join 4,000+ others and never miss out on new tips, tutorials, and more.
Latest version:
pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5
<?php OpenSwoole\Coroutine\Client->exportSocket()
None
Returns the underlying socket connection object that is being used within the client.
Export the underlying socket connection object that is being used within the client, this allows you to use the socket with PHP native functions.
You must have installed OpenSwoole using --enable-sockets
for this to work.
<?php
$socket = $client->exportSocket();
if(!socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1))
{
echo 'Unable to set option on socket: '. socket_strerror(socket_last_error()) . PHP_EOL;
}
else
{
echo "Option set on socket\n";
}