1234567891011121314151617181920 |
- <?php
- use Swoole\Coroutine\Client;
- use function Swoole\Coroutine\run;
- run(function () {
- $client = new Client(SWOOLE_SOCK_TCP);
- if (!$client->connect('10.10.10.150', 8131, 0.5))
- {
- echo "connect failed. Error: {$client->errCode}\n";
- }
- $data = [
- 'cmd' =>"getsn",
- 'id' => '22'
- ];
- $client->send("VZ00".json_encode($data));
- print_r($client->recv());
- $client->close();
- });
|