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\Client->connect(string $host, int $port = null, float $timeout = 0.1, int $sock_flag = null)
Host name or IP of the remote server
Port of the remote server
The timeout(second) of connect/send/recv, the dafault value is 0.1 second
Host name or IP of the remote server
Establish the connection.
<?php
if ($cli->connect('127.0.0.1', 9501)) {
$cli->send("data");
} else {
echo "connect failed.";
}