I am trying to use asmack 18 to connect to gtlak server for XMPP connection.
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
}
But it gives timeout error. talk.google.com:5222 Exception: Could not connect to talk.google.com:5222.; : remote-server-timeout(504) -- caused by: java.net.UnknownHostException: talk.google.com