日期:2014-05-20  浏览次数:20656 次

开发 openfire + spark + smack 问题,坐等大神
 
我用下面的很简单的代码给spark上的levin发送Howdy消息,为什么spark端收不到呢?
 XMPPConnection connection = new XMPPConnection("localhost"); 
 connection.login("mtucker", "password");  
 connection.createChat("levin@qq.com").sendMessage("Howdy!"); 


------解决方案--------------------
你把qq.com 在hosts里面映射成 127.0.0.1了吗? 
login之前加一句 connection.connect();
或者你换connection.createChat("levin@127.0.0.1").sendMessage("Howdy!"); 试试