2
我正在使用smack来连接ejabbard服务器。无法获得响应
通过咂嘴使用下面的代码
val config=XMPPTCPConnectionConfiguration.builder()
.setXmppDomain(mDomainName)
.setUsernameAndPassword(mUsername,mPassword)
.setDebuggerEnabled(true)
mConnection= XMPPTCPConnection(config.build())
Log.v("Current status ",mConnection!!.isConnected().toString())
mConnection!!.connect()
与ejabbard服务器连接,但最终得到的错误/警告:
4-15 12:09:22.626 2685-3195/com.example.itstym.kotlinchat I/DNSUtil: Could not resolve DNS SRV resource records for _xmpp-client._tcp.replica3377.cloudapp.net. Consider adding those.
04-15 12:09:23.033 2685-3208/com.example.itstym.kotlinchat D/SMACK: SENT (1): <stream:stream xmlns='jabber:client' to='replica3377.cloudapp.net' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='[email protected]' xml:lang='en'>
04-15 12:09:23.189 2685-3209/com.example.itstym.kotlinchat D/SMACK: RECV (1): <?xml version='1.0'?><stream:stream id='3002662766383892485' version='1.0' xml:lang='en' xmlns:stream='http://etherx.jabber.org/streams' to='[email protected]' from='replica3377.cloudapp.net' xmlns='jabber:client'>
04-15 12:09:23.190 2685-3209/com.example.itstym.kotlinchat D/SMACK: RECV (1): <stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>X-OAUTH2</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms></stream:features>
04-15 12:09:28.846 2685-2754/com.example.itstym.kotlinchat D/SMACK: RECV (0): <stream:error><connection-timeout xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error></stream:stream>
后30秒左右,我正在另一个错误
04-15 12:09:28.853 2685-2754/com.example.itstym.kotlinchat W/AbstractXMPPConnection: Connection XMPPTCPConnection[not-authenticated] (0) closed with error
org.jivesoftware.smack.XMPPException$StreamErrorException: connection-timeout You can read more about the meaning of this stream error at http://xmpp.org/rfcs/rfc6120.html#streams-error-conditions
<stream:error><connection-timeout xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error>
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1046)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:980)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:996)
at java.lang.Thread.run(Thread.java:818)
但是当我检查ejabbard服务器会话是为用户启动的会话。同样使用converse.js我可以验证用户是否登录。
所以我觉得我没有从smack得到响应。
如果我提出只连接请求,那么也应该给我的成功连接味精。顺便说一句,我也试图调用login()方法。但得到同样的回应。 –
@Kiskae你可以检查这个问题http://stackoverflow.com/questions/43491831/how-do-i-get-the-message-from-the-message-id-in-smack –