smack - ConnectionException when trying to connect to XMPP server from aSmack Android client -


i have been trying connect (locally hosted) openfire xmpp server asmack android client hours now, , it's still not working.

i org.jivesoftware.smack.smackexception$connectionexception , that's it.

code:

public class mainactivity extends activity {  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     smackandroid.init(getapplicationcontext());     connect(); }  private boolean connect(){     xmppconnection connection = new xmpptcpconnection(host);     try{         connection.connect();         connection.login("user", "user");     }catch (exception e){         e.printstacktrace();     }     return true; } 

server , running.

host server name, tried host name too, tried different ports... tried launch connect() method thread. tried use login or anonymous connection, exception thrown before that, @ line: connection.connect();

any highly appreciated.

i org.jivesoftware.smack.smackexception$connectionexception , that's it.

no, it's not. if @ javadoc connectionexception:

connectionexception thrown if smack unable connect hosts of given xmpp service. failed hosts can retrieved getfailedaddresses(), have exception causing connection failure set , retrievable hostaddress.getexception().

so call connectionexception.getfailedaddresses() retrieve list , check hostaddress.getexception() caused smack unable connect host.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -