修改位置:
require_once __DIR__ . '/../../Workerman/Autoloader.php';
Autoloader::setRootPath(__DIR__);
$gateway = new Gateway("Text://0.0.0.0:8282");
$gateway->transport = 'udp';
$gateway->name = 'MyAppGateway';
$gateway->count = 4;
$gateway->startPort = 2900;
$gateway->registerAddress = '127.0.0.1:1238';
使用nc命令访问
提示报错:
PHP Notice: Undefined property: Workerman\Connection\UdpConnection::$gatewayHeader in /root/文档/sevice_linux/GatewayWorker/Gateway.php on line 259
Notice: Undefined property: Workerman\Connection\UdpConnection::$gatewayHeader in /root/文档/sevice_linux/GatewayWorker/Gateway.php on line 259
PHP Notice: Undefined property: Workerman\Connection\UdpConnection::$session in /root/文档/sevice_linux/GatewayWorker/Gateway.php on line 262
写的一个小的物联网项目,需要通过udp接收数据
GatewayWorker用于tcp长连接应用,不支持udp传输协议