1、运行环境
- php版本>5.3
- workerman版本为3.5.16
- 采用源码安装Workerman
- ip为192.168.0.55
2、tcp服务代码 start_tcp.php
<?php
require_once __DIR__ . '/Autoloader.php';
use Workerman\Worker;
$http_worker = new Worker("tcp://0.0.0.0:2345");
$http_worker->onMessage = function($connection, $data){
$connection->close("you input data is:{$data}.\r\n");
};
Worker::runAll();
3、启动
- php start_tcp.php start
- 运行