91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

asmack xmpp應用遇到的問題

發布時間:2020-07-17 19:35:07 來源:網絡 閱讀:2759 作者:wb127 欄目:移動開發

項目中遇到要用xmpp做通訊,原來在的應用跑在linux上用的gloox,現在需要在android上來實現,查了下發現smack最近做了一次大升級,4.0.0發布了,最開始用了smack的庫,結果在android上報錯,去https://community.igniterealtime.org/ 社區問了下,原來還有個asmack,下了庫文件然后寫代碼:

根據asmack-android-8-4.0.0-rc2.jar 的readme,另外需要dnsjava的庫,我用的是dnsjava-2.1.6

最開始發現logcat有一個關于dns的報錯,網上查了下發現有說要加下面一句在初始化的時候:        

        //System.setProperty("sun.net.spi.nameservice.provider.1","dns,dnsjava");

但是后來我發現沒有這句,好像也沒問題,暫時屏蔽掉了。


asmack的初始化是必須的。

        mSmackAndroid = SmackAndroid.init(context);


        conf = new ConnectionConfiguration( "wooxonline.com",5222);

         SASLAuthentication.supportSASLMechanism("PLAIN",0);

        conf.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);

        conf.setCompressionEnabled(false);

        // disable the built-in ReconnectionManager since we handle this

        conf.setReconnectionAllowed(false);

        conf.setSendPresence(false);

        conf.setDebuggerEnabled(true);

        XMPPConnection connection = XMPPTCPConnection(conf);

        connection.login(g_email, g_password);

最開始少了sasl方式的設置,發現連接沒問題,但是login的時候總是返回noresponse error,查了發現asmask對于連接出錯拋的異常比較簡單,不會細分。

log如下:

connect:

06-17 09:39:09.300  19344-19457/com.wooxclound.homedaemonactivity.app D/SMACK﹕ SENT (0): <stream:stream to="wooxonline.com" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">

06-17 09:39:12.500  19344-19458/com.wooxclound.homedaemonactivity.app D/SMACK﹕ RCV (0): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='1920830504' from='wooxonline.com' version='1.0' xml:lang='en'><stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='k0acyvEdZQ7cl5uD5FTPoiOnuaw='/><register xmlns='http://jabber.org/features/iq-register'/></stream:features>


login:

06-17 09:39:21.500  19344-19457/com.wooxclound.homedaemonactivity.app D/SMACK﹕ SENT (0): <auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">AHRlc3QxMUB3b294b25saW5lLmNvbQBhYjEyMzR5eg==</auth>

06-17 09:39:21.500  19344-19344/com.wooxclound.homedaemonactivity.app I/Woox HomeDaemon﹕ onStartCommand(): Intent com.wooxclound.homedaemon.action.XMPP.CONNECTION_CHANGED

06-17 09:39:22.090  19344-19458/com.wooxclound.homedaemonactivity.app D/SMACK﹕ RCV (0): <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>

06-17 09:39:22.100  19344-19458/com.wooxclound.homedaemonactivity.app D/SMACK﹕ SENT (0): <stream:stream to="wooxonline.com" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">

06-17 09:39:22.490  19344-19458/com.wooxclound.homedaemonactivity.app D/SMACK﹕ RCV (0): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='2952941696' from='wooxonline.com' version='1.0' xml:lang='en'><stream:features><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='k0acyvEdZQ7cl5uD5FTPoiOnuaw='/><register xmlns='http://jabber.org/features/iq-register'/></stream:features>

06-17 09:39:22.540  19344-19346/com.wooxclound.homedaemonactivity.app D/dalvikvm﹕ GC_CONCURRENT freed 311K, 8% free 5028K/5408K, paused 4ms+3ms, total 26ms

06-17 09:39:22.560  19344-19457/com.wooxclound.homedaemonactivity.app D/SMACK﹕ SENT (0): <iq id='Aa7TB-0' type='set'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><resource>Smack</resource></bind></iq>

06-17 09:39:23.130  19344-19458/com.wooxclound.homedaemonactivity.app D/SMACK﹕ RCV (0): <iq id='Aa7TB-0' type='result'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>test11@wooxonline.com/Smack</jid></bind></iq>

06-17 09:39:23.130  19344-19457/com.wooxclound.homedaemonactivity.app D/SMACK﹕ SENT (0): <iq id='Aa7TB-1' type='set'><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq>

06-17 09:39:23.720  19344-19458/com.wooxclound.homedaemonactivity.app D/SMACK﹕ RCV (0): <iq type='result' id='Aa7TB-1'/>

06-17 09:39:23.730  19344-19454/com.wooxclound.homedaemonactivity.app D/SMACK﹕ User logged (0): test11@wooxonline.com@wooxonline.com:0/Smack

在注冊新用戶的時候,可以使用accountmanager也可以使用IQ package,方法如下:

    public static final int REGISTER_METHOD_ACCOUNT_MANAGER = 0;

    public static final int REGISTER_METHOD_IQ_PACKAGE = 1;


    public static final int REGISTER_RESULT_SERVER_NO_RESULT = 0;

    public static final int REGISTER_RESULT_SUCCESS = 1;

    public static final int REGISTER_RESULT_ACCOUNT_EXIST = 2;

    public static final int REGISTER_RESULT_FAIL = 4;

    public static final int REGISTER_RESULT_NO_CONNECTION = 4;

/**

     * register

     *

     * @param username

     * @param password

     * @return 1:success 0:server not return 2:account exist 3:fail 4:no connection

     */

   

    public int register(String username, String password) {

        if (!((mConnection != null) && mConnection.isConnected())) {

            return REGISTER_RESULT_NO_CONNECTION;

        } else {

            reg_method = REGISTER_METHOD_ACCOUNT_MANAGER;

            Map<String, String> attributes = new HashMap<String, String>();

            attributes.put("username", username);

            attributes.put("password", password);

            //attributes.put("email", "");

            //attributes.put("name", "");

            if (reg_method == REGISTER_METHOD_ACCOUNT_MANAGER) {

                try {

                    if (mAccountManager == null) {

                        mAccountManager = AccountManager.getInstance(mConnection);

                    }

                    mAccountManager.createAccount(username, password, attributes);

                } catch (Exception ex) {

                    L.e(TAG, ex);

                    if (ex.toString().equalsIgnoreCase("conflict")) {

                        L.i(XmppManager.class, " account exist!");

                        return REGISTER_RESULT_ACCOUNT_EXIST;

                    } else {

                        L.i(XmppManager.class, " register fail");

                        return REGISTER_RESULT_FAIL;

                    }

                }

                L.i(XmppManager.class, " register success!");

                return REGISTER_RESULT_SUCCESS;

            } else if (reg_method == REGISTER_METHOD_IQ_PACKAGE) {

                try {

                    Registration reg = new Registration();


                    reg.setType(IQ.Type.SET);

                    reg.setTo(mConnection.getServiceName());

                    reg.setAttributes(attributes);

                    PacketFilter filter = new AndFilter(new PacketIDFilter(reg.getPacketID()),

                            new PacketTypeFilter(IQ.class));

                    PacketCollector collector = mConnection.createPacketCollector(filter);

                    mConnection.sendPacket(reg);

                    IQ result = (IQ) collector.nextResult(SmackConfiguration.getDefaultPacketReplyTimeout());


                    collector.cancel();

                    //System.out.println(result);

                    if (result == null) {

                        L.i(XmppManager.class, " no value return by server!");

                        return REGISTER_RESULT_SERVER_NO_RESULT;

                    } else if (result.getType() == IQ.Type.ERROR) {

                        //<error code="409" type="cancel"><conflict xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error>

                        if (result.getError().toString().equalsIgnoreCase("conflict")) {

                            L.i(XmppManager.class, " account exist!");

                            return REGISTER_RESULT_ACCOUNT_EXIST;

                        } else {

                            L.i(XmppManager.class, " register fail");

                            return REGISTER_RESULT_FAIL;

                        }

                    } else if (result.getType() == IQ.Type.RESULT) {

                        L.i(XmppManager.class, " register success!");

                        //Intent intent = new Intent(DaemonService.ACTION_REGISTER);

                        return REGISTER_RESULT_SUCCESS;

                    }

                    L.e(TAG, ":Should not go there for register process!");

                } catch (Exception ex) {

                    L.e(TAG, ex);

                }

            }

            L.e(TAG, ":Should not go there for register process!");

            return REGISTER_RESULT_FAIL;

        }

    }

}


當賬戶存在時,返回如下包:

D/SMACK﹕ RCV (0): <iq type="error" id="EzQN5-0" from="ddnas-v2.com" to="ddnas-v2.com/c220b282"><query xmlns="jabber:iq:register"><email> </email><password>jacky</password><username>jacky</username><name> </name></query><error code="409" type="cancel"><conflict xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>

但是geterrorcode()接口似乎在4.0的asmack中被去掉了,所以只能判定error是conflict就認為是賬戶已經存在。


由于服務器強制使用TLS認證,所以對于連接做了新的配置,然后再openfire server上測試沒有問題,但是在公司的服務器出問題了,最先我用的是asmak 4.0.0 rc2的庫,在認證challenge的時候服務器似乎沒有響應,log如下:

D/SMACK﹕ SENT (0): <stream:stream to="wooxonline.com" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">

D/SMACK﹕ RCV (0): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='2936112787' from='wooxonline.com' version='1.0' xml:lang='en'><stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='k0acyvEdZQ7cl5uD5FTPoiOnuaw='/><register xmlns='http://jabber.org/features/iq-register'/></stream:features>

D/SMACK﹕ SENT (0): <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>

D/SMACK﹕ RCV (0): <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>

W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection.initReaderAndWriter(XMPPTCPConnection.java:501)

W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection.proceedTLSReceived(XMPPTCPConnection.java:648)

W/System.err﹕ at org.jivesoftware.smack.tcp.PacketReader.parsePackets(PacketReader.java:223)

W/System.err﹕ at org.jivesoftware.smack.tcp.PacketReader.access$000(PacketReader.java:48)

W/System.err﹕ at org.jivesoftware.smack.tcp.PacketReader$1.run(PacketReader.java:82)

W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection.initReaderAndWriter(XMPPTCPConnection.java:501)

W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection.proceedTLSReceived(XMPPTCPConnection.java:648)

W/System.err﹕ at org.jivesoftware.smack.tcp.PacketReader.parsePackets(PacketReader.java:223)

W/System.err﹕ at org.jivesoftware.smack.tcp.PacketReader.access$000(PacketReader.java:48)

W/System.err﹕ at org.jivesoftware.smack.tcp.PacketReader$1.run(PacketReader.java:82)

D/SMACK﹕ SENT (0): <stream:stream to="wooxonline.com" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">

D/SMACK﹕ RCV (0): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='3044304500' from='wooxonline.com' version='1.0' xml:lang='en'>

D/SMACK﹕ RCV (0): <stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='k0acyvEdZQ7cl5uD5FTPoiOnuaw='/><register xmlns='http://jabber.org/features/iq-register'/></stream:features>

D/SMACK﹕ SENT (0): <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl"></auth>

D/SMACK﹕ RCV (0): <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>bm9uY2U9IjIyNzI1NzYwOTQiLHFvcD0iYXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09bWQ1LXNlc3M=</challenge>

D/SMACK﹕ SENT (0): </stream:stream>

W/XMPPConnection﹕ Connection closed with error

    java.lang.NullPointerException

            at com.novell.sasl.client.DigestMD5SaslClient.DigestCalcHA1(DigestMD5SaslClient.java:447)

            at com.novell.sasl.client.DigestMD5SaslClient.createDigestResponse(DigestMD5SaslClient.java:646)

            at com.novell.sasl.client.DigestMD5SaslClient.evaluateChallenge(DigestMD5SaslClient.java:356)

            at org.jivesoftware.smack.sasl.SASLMechanism.challengeReceived(SASLMechanism.java:190)

            at org.jivesoftware.smack.SASLAuthentication.challengeReceived(SASLAuthentication.java:427)

            at org.jivesoftware.smack.tcp.PacketReader.parsePackets(PacketReader.java:252)

            at org.jivesoftware.smack.tcp.PacketReader.access$000(PacketReader.java:48)

            at org.jivesoftware.smack.tcp.PacketReader$1.run(PacketReader.java:82)

翻了一下asmack社區的帖子https://community.igniterealtime.org/message/240015#240015上說rc3的庫解決了這個問題,down下來一試,果然,但是認證還是通不過:

D/SMACK﹕ SENT (0): <stream:stream to="wooxonline.com" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">

D/SMACK﹕ RCV (0): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='83599252' from='wooxonline.com' version='1.0' xml:lang='en'><stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='k0acyvEdZQ7cl5uD5FTPoiOnuaw='/><register xmlns='http://jabber.org/features/iq-register'/></stream:features>

D/SMACK﹕ SENT (0): <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>

D/SMACK﹕ RCV (0): <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>

W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection.initReaderAndWriter(XMPPTCPConnection.java:501)

W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection.proceedTLSReceived(XMPPTCPConnection.java:648)

W/System.err﹕ at org.jivesoftware.smack.tcp.PacketReader.parsePackets(PacketReader.java:223)

W/System.err﹕ at org.jivesoftware.smack.tcp.PacketReader.access$000(PacketReader.java:48)

W/System.err﹕ at org.jivesoftware.smack.tcp.PacketReader$1.run(PacketReader.java:82)

W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection.initReaderAndWriter(XMPPTCPConnection.java:501)

W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection.proceedTLSReceived(XMPPTCPConnection.java:648)

W/System.err﹕ at org.jivesoftware.smack.tcp.PacketReader.parsePackets(PacketReader.java:223)

W/System.err﹕ at org.jivesoftware.smack.tcp.PacketReader.access$000(PacketReader.java:48)

W/System.err﹕ at org.jivesoftware.smack.tcp.PacketReader$1.run(PacketReader.java:82)

D/SMACK﹕ SENT (0): <stream:stream to="wooxonline.com" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">

D/SMACK﹕ RCV (0): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='1654478887' from='wooxonline.com' version='1.0' xml:lang='en'>

D/SMACK﹕ RCV (0): <stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='k0acyvEdZQ7cl5uD5FTPoiOnuaw='/><register xmlns='http://jabber.org/features/iq-register'/></stream:features>

D/SMACK﹕ SENT (0): <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl"></auth>

D/SMACK﹕ RCV (0): <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>bm9uY2U9IjI4MDgzODM5MDUiLHFvcD0iYXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09bWQ1LXNlc3M=</challenge>

D/SMACK﹕ SENT (0): <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9InRlc3QxMkB3b294b25saW5lLmNvbSIsY25vbmNlPSIwNWUxNjVlMjUxZDA2MzM3MzJmZWZjNzBjMDU4ZTkwMDU4YjM0MjE0Mjg4ZDlmNzM1NTAwMDVkOTc4NWIwNmFlIixuYz0wMDAwMDAwMSxxb3A9YXV0aCxkaWdlc3QtdXJpPSJ4bXBwL3dvb3hvbmxpbmUuY29tIixyZXNwb25zZT05YThiMzkxZjNjM2Q0MzdjOTc0MDNkYzJiNzkyNGU5MixjaGFyc2V0PXV0Zi04LG5vbmNlPSIyODA4MzgzOTA1Ig==</response>

D/SMACK﹕ RCV (0): <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><not-authorized/></failure>

D/SMACK﹕ SENT (1): <stream:stream to="wooxonline.com" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">

D/SMACK﹕ RCV (1): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='3726488975' from='wooxonline.com' version='1.0' xml:lang='en'><stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='k0acyvEdZQ7cl5uD5FTPoiOnuaw='/><register xmlns='http://jabber.org/features/iq-register'/></stream:features>

D/SMACK﹕ SENT (1): <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>

D/SMACK﹕ RCV (1): <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>

D/SMACK﹕ SENT (1): <stream:stream to="wooxonline.com" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">

D/SMACK﹕ RCV (1): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='4109710539' from='wooxonline.com' version='1.0' xml:lang='en'>

D/SMACK﹕ RCV (1): <stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='k0acyvEdZQ7cl5uD5FTPoiOnuaw='/><register xmlns='http://jabber.org/features/iq-register'/></stream:features>

D/SMACK﹕ SENT (1): <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl"></auth>

D/SMACK﹕ RCV (1): <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>bm9uY2U9IjQyOTQ3NjMyMTciLHFvcD0iYXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09bWQ1LXNlc3M=</challenge>

D/SMACK﹕ SENT (1): <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9InRlc3QxMkB3b294b25saW5lLmNvbSIsY25vbmNlPSI1ODA3MGMzYjIxMTk5Yjc5MzUxYTc3ODkzNTkwYTNiNGFmZmQ2MjYwYTUwNGZjZmY5NTJkMjg1YWE3YmViY2VkIixuYz0wMDAwMDAwMSxxb3A9YXV0aCxkaWdlc3QtdXJpPSJ4bXBwL3dvb3hvbmxpbmUuY29tIixyZXNwb25zZT02Mzk5NGYyMzk0YjQxYjkyYjUwYzM3NDg0ZGFkNzQ5ZCxjaGFyc2V0PXV0Zi04LG5vbmNlPSI0Mjk0NzYzMjE3Ig==</response>

D/SMACK﹕ RCV (1): <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><not-authorized/></failure>

繼續翻壇子,https://code.google.com/p/gtalksms/issues/detail?id=262有人發現登陸ID不使用@域名就沒有問題,太暈了。


程序跑起來以后,使用xmpp客戶端聊天消息接收沒問題,但是通過CGI網頁pass過來的信息接收不到,初步認為應該是packetfilter的配置不對引起的。

先抓包:

From HTML page:

D/SMACK﹕ RCV (0): <message from='test00@wooxonline.com/17837575071403770533364162' to='test12@wooxonline.com'id='3'><body>{&quot;msg&quot;:&quot;hello123&quot;}</body></message>                             

From XMPP client:

D/SMACK﹕ RCV (0): <message from='test12@wooxonline.com/Gajim'to='test12@wooxonline.com/Smack' xml:lang='en' type='chat'id='30'><body>sajdhs</body><thread>DXPNsxrROrFFuvBNxxOJgaqbFeRNQYKy</thread></message>

但是從http://xmpp.org/extensions/xep-0201.html   xmpp協議上來看似乎,所有的message都應該有type和thread段。

最后將filter的配置改了一下,就能抓到了。

//PacketFilter filter = new MessageTypeFilter(Message.Type.chat);

 PacketFilter filter = new AndFilter(new PacketTypeFilter(Message.class));


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

普洱| 稷山县| 西宁市| 吴川市| 当阳市| 罗定市| 石首市| 大丰市| 天台县| 卫辉市| 平遥县| 沙坪坝区| 叙永县| 右玉县| 双柏县| 商丘市| 尉犁县| 宜黄县| 丹巴县| 专栏| 淄博市| 桂林市| 黑山县| 乌拉特后旗| 仪征市| 启东市| 夏邑县| 临颍县| 尤溪县| 胶南市| 新闻| 历史| 若尔盖县| 信阳市| 古田县| 沙湾县| 错那县| 重庆市| 百色市| 双江| 兰溪市|