bool Swoole\Server::sendto ( string $ip , int $port , string $data [, string $server_socket ] )
Send data to the remote UDP address.
To use
Swoole\Server->sendto
, the swoole server has to listen the port of UDP To useSwoole\Server->sendto
to send data to IPV6, the swoole server has to listen the port of UDP6
$ip
the string of ip address$port
the integer of port$data
the data to send$server_socket
the swoole server may listen multiple port at the same time, use $server_socket
to assign the port to useThe result of send data
<?php
$server->sendto('127.0.0.1', 9502, "hello world");
$server->sendto('2600:3c00::f03c:91ff:fe73:e98f', 9501, "hello world");