首页
下载
文档
问答社区
视频
捐赠
源代码
AI 助理
赞助商
CRMEB
Apipost
腾讯云
微擎
禅道
51Talk
商业产品
Swoole AI 智能文档翻译器
Swoole-Compiler PHP 代码加密器
CRMEB 新零售社交电商系统
登录
注册
全部
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
发表新帖
swoole_client bug
```php <?php $client = new swoole_client(SWOOLE_SOCK_TCP, SWOOLE_SOCK_ASYNC); //0m~B步m~]~^m~X[0m~^ $client->on("connect", function($cli) { $cli->send("hello world\n"); }); $client->on("receive", function($cli, $data = ""){ $data = $cli->recv(); //1.6.10+ 0m~Mm~\~@0m~A if(empty($data)){ $cli->close(); echo "closed\n"; } else { echo "received: $data\n"; sleep(1); $cli->send("hello\n"); } }); $client->on("close", function($cli){ $cli->close(); // 1.6.10+ 0m~Mm~\~@0m~A echo "close\n"; }); $client->on("error", function($cli){ exit("error\n"); }); $client->connect('127.0.0.1', 9501, 0.5); ``` strace 结果 ``` close(0) = -1 EBADF (Bad file descriptor) close(0) = -1 EBADF (Bad file descriptor) close(0) = -1 EBADF (Bad file descriptor) close(0) = -1 EBADF (Bad file descriptor) close(0) = -1 EBADF (Bad file descriptor) close(0) = -1 EBADF (Bad file descriptor) --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xbee31f90} --- +++ killed by SIGSEGV +++ Segmentation fault ``` php版本: 5.6.17
发布于7年前 · 0 次浏览 · 来自
提问
普
普
```php <?php $client = new swoole_client(SWOOLE_SOCK_TCP, SWOOLE_SOCK_ASYNC); //0m~B步m~]~^m~X[0m~^ $client->on("connect", function($cli) { $cli->send("hello world\n"); }); $client->on("receive", function($cli, $data = ""){ $data = $cli->recv(); //1.6.10+ 0m~Mm~\~@0m~A if(empty($data)){ $cli->close(); echo "closed\n"; } else { echo "received: $data\n"; sleep(1); $cli->send("hello\n"); } }); $client->on("close", function($cli){ $cli->close(); // 1.6.10+ 0m~Mm~\~@0m~A echo "close\n"; }); $client->on("error", function($cli){ exit("error\n"); }); $client->connect('127.0.0.1', 9501, 0.5); ``` strace 结果 ``` close(0) = -1 EBADF (Bad file descriptor) close(0) = -1 EBADF (Bad file descriptor) close(0) = -1 EBADF (Bad file descriptor) close(0) = -1 EBADF (Bad file descriptor) close(0) = -1 EBADF (Bad file descriptor) close(0) = -1 EBADF (Bad file descriptor) --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xbee31f90} --- +++ killed by SIGSEGV +++ Segmentation fault ``` php版本: 5.6.17
赞
0
分享
收藏
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
评论
2017-07-01
熟
熟悉的街道
swoole-1.8.0和1.8.1存在一些BUG,请使用 1.8.2 或 1.7.22
赞
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一直是同一个。没用使用到多进程啊。