【发布时间】:2013-11-29 15:08:02
【问题描述】:
我正在尝试使用 asmack 18 连接到 gtlak 服务器以进行 XMPP 连接。
public static final String HOST = "talk.google.com";
public static final int PORT = 5222;
public static final String SERVICE = "gmail.com";
ConnectionConfiguration connConfig = new ConnectionConfiguration(HOST, PORT, SERVICE);
XMPPConnection connection = new XMPPConnection(connConfig);
try {
//Connect to the server
connection.connect();
connection.login("xxxxxxxx@gmail.com", "password");
// Set the status to available
Presence presence = new Presence(Presence.Type.available);
connection.sendPacket(presence);
//xmppClient.setConnection(connection);
Log.d("connection","connection successfull");
} catch (XMPPException ex) {
connection = null;
Log.d("connection","connection fail");
//Unable to connect to server
}
但它给出了超时错误。 talk.google.com:5222 例外:无法连接到talk.google.com:5222。; :远程服务器超时(504) -- 引起:java.net.UnknownHostException:talk.google.com
【问题讨论】:
标签: android xmpp asmack google-talk