這可能是重複的問題。從Android連接到XMPP服務器
我正在使用org.jivesoftware.smack
for android作爲XMPP客戶端進行連接。而我的代碼是
ConnectionConfiguration connConfig = new ConnectionConfiguration(HOST, PORT, SERVICE);
XMPPConnection connection = new XMPPConnection(connConfig);
try {
connection.connect();
connection.login(USERNAME, PASSWORD);
Presence presence = new Presence(Presence.Type.available);
connection.sendPacket(presence);
setConnection(connection);
} catch (XMPPException ex) {
ex.printStackTrace();
}
我'得到一個例外,如下
01-18 16:20:36.021: W/System.err(13651): No response from the server.:
01-18 16:20:36.021: W/System.err(13651): at org.jivesoftware.smack.SASLAuthentication.bindResourceAndEstablishSession(SASLAuthentication.java:307)
01-18 16:20:36.029: W/System.err(13651): at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:214)
01-18 16:20:36.029: W/System.err(13651): at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:341)
01-18 16:20:36.029: W/System.err(13651): at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:301)
01-18 16:20:36.029: W/System.err(13651): at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:283)
01-18 16:20:36.029: W/System.err(13651): at com.example.chatsample.XMPPClient.setupConnection(XMPPClient.java:112)
首先我無法連接。該代碼看起來相同,它的工作爲Gmail帳戶。 但我有一個服務器端口5222上運行1xx.1xx.x.x端口。我想連接到。 – Sundeep1501