首页
下载
文档
问答社区
视频
捐赠
源代码
AI 助理
赞助商
CRMEB
Apipost
腾讯云
微擎
禅道
51Talk
商业产品
Swoole AI 智能文档翻译器
Swoole-Compiler PHP 代码加密器
CRMEB 新零售社交电商系统
登录
注册
全部
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
发表新帖
swoole framework 客户端连接报错
**server报错信息:** [2016-07-04 15:27:59] INFO Event: client[#1@0] connect PHP Notice: Undefined index: query in /home/wwwroot/swoole-fw/framework/libs/Swoole/Request.php on line 85 PHP Notice: Undefined index: document_root in /home/wwwroot/swoole-fw/framework/libs/Swoole/Request.php on line 86 [2016-07-04 15:27:59] INFO Event: client[#1@0] close **client代码:** function go(){ $client = new Swoole\Client\WebSocket('127.0.0.1', 8888, '/'); var_dump($client); if(!$client->connect()) { echo "connect to server failed.\n"; exit; } while(true) { $client->send("hello world"); $message = $client->recv(); if($message === false) break; echo "Received from server: {$message}.".PHP_EOL; sleep(1); } echo "Closed by server.\n"; } **server代码:** define('WEBPATH', __DIR__); require __DIR__.'/libs/lib_config.php'; $AppSvr = new Swoole\Protocol\AppServer(); $AppSvr->loadSetting(__DIR__."/swoole.ini"); //加载配置文件 $AppSvr->setAppPath(__DIR__.'/apps/'); //设置应用所在的目录 $AppSvr->setLogger(new Swoole\Log\EchoLog(true)); //Logger $server = new \Swoole\Network\Server('0.0.0.0', 8888); $server->setProtocol($AppSvr); //$server->daemonize(); //作为守护进程 $server->run(array('worker_num' => 1, 'max_request' => 5000));
发布于7年前 · 0 次浏览 · 来自
提问
i
immortal
**server报错信息:** [2016-07-04 15:27:59] INFO Event: client[#1@0] connect PHP Notice: Undefined index: query in /home/wwwroot/swoole-fw/framework/libs/Swoole/Request.php on line 85 PHP Notice: Undefined index: document_root in /home/wwwroot/swoole-fw/framework/libs/Swoole/Request.php on line 86 [2016-07-04 15:27:59] INFO Event: client[#1@0] close **client代码:** function go(){ $client = new Swoole\Client\WebSocket('127.0.0.1', 8888, '/'); var_dump($client); if(!$client->connect()) { echo "connect to server failed.\n"; exit; } while(true) { $client->send("hello world"); $message = $client->recv(); if($message === false) break; echo "Received from server: {$message}.".PHP_EOL; sleep(1); } echo "Closed by server.\n"; } **server代码:** define('WEBPATH', __DIR__); require __DIR__.'/libs/lib_config.php'; $AppSvr = new Swoole\Protocol\AppServer(); $AppSvr->loadSetting(__DIR__."/swoole.ini"); //加载配置文件 $AppSvr->setAppPath(__DIR__.'/apps/'); //设置应用所在的目录 $AppSvr->setLogger(new Swoole\Log\EchoLog(true)); //Logger $server = new \Swoole\Network\Server('0.0.0.0', 8888); $server->setProtocol($AppSvr); //$server->daemonize(); //作为守护进程 $server->run(array('worker_num' => 1, 'max_request' => 5000));
赞
0
分享
收藏
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
评论
2017-11-03
C
CX.璇 逆向破解
这代码格式也太难看了吧。 初步了解是 query和document_root 没找到。
赞
0
回复
微信公众号
热门内容
暂无回复的问答
- CodeGalaxy K3s 轻量集群节点之间如何实现负载均衡
- 关于openssl CURL WARNING swSSL_connect: SSL_connect(fd=69) failed. Error: error:141A318A:SSL routines:tls_process_ske_dhe:dh key too small[1|394]
- 多个模型如何进行事务异常回退?
- websocket开启wss报错
- 协程tcp服务器如何使用多进程?recv()方法接收信息,打印出来的pid一直是同一个。没用使用到多进程啊。