关于安卓6.0.1系统Xmpp不能链接的问题!“No response from the server”
2016-04-12 16:09
447 查看
今天客户在用程序的时候发现安卓6.0.1的程序死活不能登陆,但是获取版本号或者在6.0以下的手机上时没问题的! 看了下是xmpp链接除了问题,查了查发现当登陆的时候会出现“No response from the server”!
发现:
发现:
XMPPConnection connection = new XMPPConnection(getConfig(xmppPort));connection.connect();返回是链接成功的;
然后发现“No response from the server”出现在2个地方:
1:
IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); if (response == null) { throw new XMPPException("No response from the server."); }
2: Bind response = (Bind) collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); collector.cancel(); if (response == null) { throw new XMPPException("No response from the server."); } IQ ack = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); collector.cancel(); if (ack == null) { throw new XMPPException("No response from the server."); }
所以resource bind失败,或者确实没有收到response包。smack又是一个封装的库,参数只有用户名,密码和SecurityMode了。所有最后发现问题出现在了TLS链路上。所以改了下默认的enable为disable,问题立即解决,虽说安全系数下降,但是找了好久只有找到这个方法了。如果你们有好的方法,可以给我留言啊!
最后贴上修改后的代码:
ConnectionConfiguration config = new ConnectionConfiguration(GlobalConstant.XMPPServerName, Integer.valueOf(xmppPort)); config.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);//这是要修改的部门,上边只是实例。
相关文章推荐
- leetcode--最长非重复子序列--O(n)--基于队列
- iOS tableView刷新选中cell数据
- centos 5.8下搭建extmail服务的总结
- SQL:insert来至select的数据
- 图片上传不到服务器
- 关于中国人工智能学会的分支机构改革与面向未来的几个问题
- uva 10245 The Closest Pair Problem
- c++继承与多态
- android studio 安装(mac)
- HDU 1556 Color the ball(线段树的区间更新【注释】)
- android(NDK+JNI)---NDK 编译和使用静态库、动态库
- 打印程序执行时间的小工具
- 【mkfs】创建文件系统
- [windows]清除访问共享的用户和密码信息
- java中用StringBuffer写文件换行
- 文件下载知识
- Zookeeper基础—Zookeeper介绍
- Linux下的Postfix邮件服务器
- linux线程资源回收方法
- perl unicode utf-8 \x转换