大家好,现在一直连接不上TCP服务器
代码如下:
// 新增8283端口,开启tcp协议
$gateway_tcp = new Gateway("tcp://0.0.0.0:8283");
// 进程名称,主要是status时方便识别
$gateway_tcp->name = 'GatewayTcp';
// 开启多少tcp协议的gateway进程
$gateway_tcp->count = 4;
// 本机ip(分布式部署时需要设置成内网ip)
$gateway_tcp->lanIp = '127.0.0.1';
// gateway内部通讯起始端口,起始端口不要重复
$gateway_tcp->startPort = 2500;
// 心跳间隔
$gateway_tcp->pingInterval = 10;
$gateway_tcp->pingNotResponseLimit = 2;
// 心跳数据
$gateway_tcp->pingData = 'ping';
// 设置服务注册地址(注意:这个地址是start_register.php中监听的地址)
$gateway_tcp->registerAddress = '127.0.0.1:1237';
// ######新增端口支持Text协议 结束##
$gateway_tcp->onConnect = function($connection)
{
$connection->send('Connected!');
};
if(!defined('GLOBAL_START'))
{
Worker::runAll();
}
服务器状态是下面这样,但是用网络助手连接TCP服务器就是连接不上,用的是腾讯云国外Linux服务器,防火墙已经关闭,请大家帮忙看看是怎么回事
----------------------------------------------GLOBAL STATUS----------------------------------------------------
Workerman version:3.5.5 PHP version:5.5.38
start time:2018-03-18 15:21:00 run 16 days 7 hours
load average: 0, 0, 0 event-loop:\Workerman\Events\Select
5 workers 17 processes
worker_name exit_status exit_count
BusinessWorker 0 0
Gateway 0 0
Register 0 0
GatewayTcp 0 0
GatewayText 0 0
----------------------------------------------PROCESS STATUS---------------------------------------------------
pid memory listening worker_name connections send_fail timers total_request qps status
19897 2M none BusinessWorker 13 0 0 7 0
19898 2M none BusinessWorker 13 0 0 9 0
19899 2M none BusinessWorker 13 0 0 9 0
19900 2M none BusinessWorker 13 0 0 7 0
19901 1.5M websocket://0.0.0.0:8288 Gateway 5 0 1 4 0
19902 1.5M websocket://0.0.0.0:8288 Gateway 5 0 1 4 0
19903 1.5M websocket://0.0.0.0:8288 Gateway 5 0 1 4 0
19904 1.5M websocket://0.0.0.0:8288 Gateway 5 0 1 4 0
19905 1.5M text://0.0.0.0:1237 Register 16 0 0 16 0
19906 1.5M tcp://0.0.0.0:8283 GatewayTcp 5 0 1 4 0
19907 1.5M tcp://0.0.0.0:8283 GatewayTcp 5 0 1 4 0
19908 1.5M tcp://0.0.0.0:8283 GatewayTcp 5 0 1 4 0
19909 1.5M tcp://0.0.0.0:8283 GatewayTcp 5 0 1 4 0
19910 1.5M text://0.0.0.0:7070 GatewayText 5 0 0 4 0
19911 1.5M text://0.0.0.0:7070 GatewayText 5 0 0 4 0
19912 1.5M text://0.0.0.0:7070 GatewayText 5 0 0 4 0
19913 1.5M text://0.0.0.0:7070 GatewayText 5 0 0 4 0
找下腾讯云的技术人员给你看下,感觉是服务器问题