首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

使用Smack碰到若干有关问题的解决

2012-10-09 
使用Smack碰到若干问题的解决????public class XmppTest {public static void main(String[] args) throws

使用Smack碰到若干问题的解决

?

?

?

?

public class XmppTest {        public static void main(String[] args) throws Exception {                String username = "userName@serverName.com";        String password = "your password";                XmppManager xmppManager = new XmppManager("serverName.com", 5222);        System.out.println("连接服务器成功!");        xmppManager.init();        System.out.println("初始化成功!");        xmppManager.performLogin(username, password);        System.out.println("登录成功!");               xmppManager.setStatus(true, "Hello everyone");                String buddyJID = "friend@serverName.com";        String buddyName = "friend";        xmppManager.createEntry(buddyJID, buddyName);                xmppManager.sendMessage("Hello mate", "friend@serverName.com");        System.out.println("发送消息成功!");        boolean isRunning = true;                while (isRunning) {            Thread.sleep(50);        }                xmppManager.destroy();            }}

热点排行