Init Repo

This commit is contained in:
root
2019-09-06 23:53:10 +08:00
commit f0ef89dfbb
7905 changed files with 914138 additions and 0 deletions

21
vendor/swoole/examples/event/stream.php vendored Executable file
View File

@ -0,0 +1,21 @@
<?php
$fp = stream_socket_client("tcp://127.0.0.1:9502", $errno, $errstr, 30);
if (!$fp) {
exit("$errstr ($errno)<br />\n");
}
fwrite($fp, "HELLO world");
function stream_onRead($fp)
{
echo fread($fp, 1024)."\n";
sleep(1);
swoole_event_write($fp, "hello world");
//swoole_event_set($fp, null, null, SWOOLE_EVENT_READ | SWOOLE_EVENT_WRITE);
//swoole_event_del($fp);
//fclose($fp);
}
swoole_event_add($fp, 'stream_onRead');
echo "start\n";