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();

    推荐阅读