channelClient - connect
优质
小牛编辑
125浏览
2023-12-01
(要求Workerman版本>=3.3.0)
void ChannelClient::connect([string $listen_ip = '127.0.0.1', int $listen_port = 2206])
连接Channel/Server
参数
listen_ip
Channel/Server 监听的ip地址,不传默认是127.0.0.1
listen_port
Channel/Server监听的端口,不传默认是2206
返回值
void
示例
<?php
use WorkermanWorker;
require_once __DIR__ . '/Workerman/Autoloader.php';
require_once __DIR__ . '/Channel/src/Client.php';
$http_worker = new Worker('http://0.0.0.0:4237');
$http_worker->onWorkerStart = function()
{
ChannelClient::connect('127.0.0.1', 2206);
};
Worker::runAll();