Hello everybody,
yesterday I entered in the fabulous world of XMPP... That's not a piece of cake. Anyway... I installed openfire on a server and that went well. To test it, I installed Spark on another computer and I tried to connect to my OpenFire server and... it went well, so cool... I told myself that I was ready to build an android app (which is my final goal) that connect to this OpenFire server and that went well... No, I'm kidding, that's when the pain started...
I downloaded the very last version of asmack (I guess it's the very last as its date is 16 of augustus). At the end, I came up with the following code:
private class OpenConnectionAction extends AsyncTask<Void, Void, Void>
{
@Override
protected Void doInBackground(Void... arg0)
{
SmackAndroid.init(getApplicationContext());
ConnectionConfiguration config = new ConnectionConfiguration("THE IP OF THE SERVER");
connection = new XMPPTCPConnection(config);
try
{
Log.d("WISH", "Connecting...");
connection.connect();
Log.d("WISH", "Logging in...");
connection.login("Admin", "********");
Log.d("WISH", "Connected!");
}
catch (Exception ex)
{
connection = null;
Log.d("WISH", "UNABLE TO CONNECT: " + Log.getStackTraceString(ex));
}
return null;
}
}
When I execute this code, I see the "Connecting..." message and after 5 or 6 seconds, I enter the catch. First, I tried to display the message of the exception but it was null. When I display the stack trace of it, I get this:
08-17 02:53:53.532: D/WISH(23942): UNABLE TO CONNECT: org.jivesoftware.smack.SmackException$NoResponseException
08-17 02:53:53.532: D/WISH(23942): at org.jivesoftware.smack.XMPPConnection.throwConnectionExceptionOrNoResponse(XMPP Connection.java:548)
08-17 02:53:53.532: D/WISH(23942): at org.jivesoftware.smack.tcp.XMPPTCPConnection.throwConnectionExceptionOrNoRespon se(XMPPTCPConnection.java:864)
08-17 02:53:53.532: D/WISH(23942): at org.jivesoftware.smack.tcp.XMPPTCPConnection.initConnection(XMPPTCPConnection.j ava:479)
08-17 02:53:53.532: D/WISH(23942): at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPC onnection.java:437)
08-17 02:53:53.532: D/WISH(23942): at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection. java:808)
08-17 02:53:53.532: D/WISH(23942): at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:396)
08-17 02:53:53.532: D/WISH(23942): at com.areaprog.wish.activities.ProfileActivity$OpenConnectionAction.doInBackgroun d(ProfileActivity.java:64)
08-17 02:53:53.532: D/WISH(23942): at com.areaprog.wish.activities.ProfileActivity$OpenConnectionAction.doInBackgroun d(ProfileActivity.java:1)
Yeah well... No response, awesome... I tried to put "5222" as second parameter of the ConnectionConfiguration object but it does not change anything. The weird thing is I tried to replace the IP by "google talk stuff" and then I got a different error message (saying something with plain authentication) but at least I got a message, showing that the server could be reached... So the question is "why can't I connect my server while Spark can with the same information..."
Thanks for your help.