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->recvfrom(float $timeout, string $address, int $port): string|bool
The timeout period of how long to wait to receive data, in seconds. So 1.5 is 1.5 seconds.
The IP (v4 or v6) of the remote server to temporarily connect to
The port number of the server to temporarily connect to.
If the remote server connection returns an empty string, it means the server has closed the connection and if there was an error,
false will be returned, check the reason why with
Temporarily receive data from a remote server connection using an IP and port. This method only operates using the UDP protocol.
EOF/Length checking is enabled, the client will returns the whole package, check the client configuration on how to setup EOF checking and protocol analysis.
For more information and details, see the main recv() method.
Also checkout the timeout guide to understand how to setup timeouts.