0
我在我的Macbook上成功安裝了ejabberd服務器,並使用iChat和Adium對其進行了測試。我正在嘗試安裝Jabberd/XMPP客戶端以在Android操作系統上工作。下面的代碼引發的connection.connect()
方法異常:Smack與服務器故障的連接
public void login(String username, String password) throws XMPPException {
ConnectionConfiguration config = new ConnectionConfiguration("my-ejabberd-server-macbook.local", 5222);
connection = new XMPPConnection(config);
XMPPConnection.DEBUG_ENABLED = true;
SASLAuthentication.supportSASLMechanism("PLAIN", 0);
connection.connect();
connection.login(username, password);
}
以下異常是在connection.connect()
方法調用創建:
XMPPError connecting to my-ejabberd-server-macbook.local:5222.: remote-server-error(502) XMPPError connecting to my-ejabberd-server-macbook.local:5222.
-- caused by: java.net.SocketException: Host is unresolved: my-ejabberd-server-macbook.local
我在Android清單中唯一以下權限:
<uses-permission android:name="android.permission.INTERNET" />
你是否解決了這個問題。我面對同樣的情況。 – WannaBeGeek 2014-11-26 05:41:28