TCP代理
count = 20;
//远程tcp地址
define('DB_HOST', 'xxx.xxx.xxx.xxx');
//远程tcp端口
define('DB_PORT', '3306');
// tcp连接建立后
$worker->onConnect = function ($connection) {// 建立3306端口的异步连接
$connection_to_3306 = new AsyncTcpConnection('tcp://' . DB_HOST . ':' . DB_PORT);
// 设置将当前客户端连接的数据导向3306端口的连接
$connection->pipe($connection_to_3306);
// 设置3306端口连接返回的数据导向客户端连接
$connection_to_3306->pipe($connection);
// 执行异步连接
$connection_to_3306->connect();
};
// 运行worker
Worker::runAll();
推荐阅读
- CVE-2020-16898|CVE-2020-16898 TCP/IP远程代码执行漏洞
- 事件代理
- 设计模式-代理模式-Proxy
- java静态代理模式
- Kotlin基础(10)-代理模式在kotlin中的使用
- 2019年PB|2019年PB County Senior Open, 保龄生涯(64)
- 计算机网络基础TCP\HTTP\HTTPS
- TCP长连接与段链接
- CountDownLatch-线程并发的发令枪
- TCP组件设计篇(详细设计)