<?php
Swoole\Event->write(int $fd, string $data)
fd
of the socket
Data sending to the sock
if success, it returns TRUE, otherwise it returns FALSE.
Write data to the socket with async I/O.
<?php
$fp = stream_socket_client('tcp://127.0.0.1:9501');
$data = str_repeat('A', 1024 * 1024 * 2);
Swoole\Event::add($fp, function($fp) {
echo fread($fp);
});
Swoole\Event::write($fp, $data);