• 大小: 6KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-01-04
  • 语言: Java
  • 标签: JAVA  openfire  xmpp  smack  

资源简介

利用smack对xmpp协议的封装,对openfire服务器进行高效简单的连接

资源截图

代码片段和文件信息

package com.tranzda;

import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;

public class Conn {
        private static XMPPConnection connection = null ;
       
        public static XMPPConnection getConnection(ConnectionConfiguration domain)
                        throws XMPPException {
                XMPPConnection connection = new XMPPConnection(domain);
                connection.connect();
                return connection;
        }

        public static XMPPConnection getConnection(String domain int port)  throws XMPPException {
                if(connection==null){
                        ConnectionConfiguration config = new ConnectionConfiguration(domainport);
   

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        613  2013-10-29 15:32  openfireClient\.classpath

     文件        390  2013-10-29 15:21  openfireClient\.project

     文件        598  2013-10-29 15:21  openfireClient\.settings\org.eclipse.jdt.core.prefs

     文件       1562  2013-11-04 16:04  openfireClient\bin\com\tranzda\Conn.class

     文件       1150  2013-11-04 16:11  openfireClient\bin\com\tranzda\Test$1.class

     文件       2063  2013-11-04 16:11  openfireClient\bin\com\tranzda\Test.class

     文件       2887  2013-11-04 16:32  openfireClient\bin\com\tranzda\test.xml

     文件       1148  2013-11-04 16:04  openfireClient\src\com\tranzda\Conn.java

     文件       1671  2013-11-04 16:11  openfireClient\src\com\tranzda\Test.java

     文件       2887  2013-11-04 16:32  openfireClient\src\com\tranzda\test.xml

     目录          0  2013-11-05 10:28  openfireClient\bin\com\tranzda

     目录          0  2013-11-05 10:28  openfireClient\src\com\tranzda

     目录          0  2013-11-05 10:28  openfireClient\bin\com

     目录          0  2013-11-05 10:28  openfireClient\src\com

     目录          0  2013-11-05 10:28  openfireClient\.settings

     目录          0  2013-11-05 10:28  openfireClient\bin

     目录          0  2013-11-05 10:28  openfireClient\src

     目录          0  2013-11-05 10:28  openfireClient

----------- ---------  ---------- -----  ----

                14969                    18


评论

共有 条评论