ConnectionConfiguration config = new ConnectionConfiguration("wang-think");
config.setCompressionEnabled(true);
config.setSASLAuthenticationEnabled(true);
connection = new XMPPConnection(config);
// Connect to the server
connection.connect();
// Log into the server
connection.login("majian", "majian", "SomeResource");
// Disconnect from the server
//connection.disconnect();//需要时可以使用该方法断开连接
while(true);死循环,维持该连接不中断
Smack开发Demo一------管理连接
最新推荐文章于 2019-04-22 16:58:07 发布