No response from server Smack org.jivesoftware.smackx.muc.MultiUserChat.create

来源:互联网 发布:压缩命令 linux gzip 编辑:程序博客网 时间:2024/05/14 05:17

Exception in thread "main" No response from server.: 
at org.jivesoftware.smackx.muc.MultiUserChat.create(MultiUserChat.java:367)
at com.smack.Test3CreateChatGroup.creatMultiRoom(Test3CreateChatGroup.java:44)

这个问题被搞了一天,下班之前终于搞定了,查了很多资料。

具体参考如下(我都没有解决)

1:http://blog.csdn.net/za143567229za/article/details/40654851 

2:http://macleo.iteye.com/blog/1815024

3:应该是网络环境不好

最后看来一个评论,给了我思路:http://blog.csdn.net/lnb333666/article/details/7598683  14楼 传入房间的的jid,不是用户的,我之前遇到过。


 MultiUserChat muc = new MultiUserChat(connection, "wq@192.168.1.1"); 这是我之前的写法(也试过很多种格式,均不行),看完评论觉得是地址写错了 .

接着仔细看了spark的群组,发现是 wq@muc.192.168.1.1。然后加上了muc,之前看了很多案例,都没有加muc,都是直接写的地址,不知道为啥我的要加这个。


不要以为加上这个就可以创建成功了,只是不会报错

还要加很多参数

感觉    muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));    这句最有用。

还有在其他帖子看到的一句话:

  1. /*---创建默认配置的聊天室 ---  
  2.             先看看官方的文档:  
  3.             Creates a new multi user chat with the specified connection and room name. Note: no 
  4.                   * information is sent to or received from the server until you attempt to  
  5.                  * {@link #join(String) join} the chat room. On some server implementations, 
  6.                   * the room will not be created until the first person joins it  
  7.                  * 最重要一句:直到用户调用join方法的时候聊天室才会被创建  
  8.                  */   

写到这就差不多了,但是服务停止聊天室就没了,不是持久 的,后面还要在研究。。。。

0 0
原创粉丝点击