1 Unstar Star 0 Fork 0

天蝎儿 / swoole多进程行务PHP

Clone or download
Client.php
Copy Edit Web IDE Raw Normal History
ME倒霉怪   初始化 2020-07-01
<?php/* * 客户端投递任务 * */for($i=0;$i<1;$i++) {    $socket=new \Co\Socket(AF_INET,SOCK_STREAM,0);    go(function () use ($socket, $i) {        $id = $i+1;        $rebe = 10000;        $socket->connect('127.0.0.1', 9515);        while ($rebe > 0) {           // co::sleep(0.1);            $random = random_int(1, 10);            $message = str_repeat('hello=>' . $rebe . '&', $random);            $message = json_encode(['id' => $id,'number'=>$rebe, 'message' => $message]);            $messageByte = packs($message);            $socket->send($messageByte);            $rebe--;            //co::sleep(0.1);        }    });}function packs($message){    $fooLenn = pack("N", strlen($message));    $package = $fooLenn . $message;    return $package;}
PHP
1
https://gitee.com/kelley0827/swote_multi_process_operation.git
git@gitee.com:kelley0827/swote_multi_process_operation.git
kelley0827
swote_multi_process_operation
swoole多进程行务
master

Search

132457 8cb2edc1 1899542 131848 70c8d3a4 1899542