Swoole\Coroutine\Client->sendto(...)

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


Latest version: pecl install openswoole-22.1.2

Declaration

<?php Swoole\Coroutine\Client->sendto(string $ip, int $port, string $data): bool

Parameters

ip

The remote IP to connect to that isn't already connected to the client.

port

The remote port to use.

data

The data to send to the remote server.

Return

Returns true when successful and false when not.


Description

Send data to a remote IP and port, that isn't already connected to the client. This function only supports the UDP protocol, even if the client is setup to use TCP.

This method is useful when you are already connected to a remote server but need to make a request quickly to another remote host, as a one off.

Last updated on August 31, 2022