AnsweredAssumed Answered

Can't establish a connection with aSmack

Question asked by fabriikki on Aug 9, 2014
Latest reply on Aug 17, 2014 by ssougnez

Hi. I'm trying to make a connection to my Openfire server running on my home computer using following code:

 

public class MainActivity extends ActionBarActivity {

 

    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

       

        ConnectionConfiguration connConfig = new ConnectionConfiguration("192.168.0.101", 5222, "home");

        XMPPConnection connection = new XMPPTCPConnection(connConfig);

        try

        {

         connection.connect();

         connection.login("user", "12345");

        }catch (Exception ex)

        {

                  Log.e("ERROR", "Exception", ex);

        }

       

       

    }

 

I'm getting followin stack trace

 

08-09 15:28:08.097: E/ERROR(838): Exception

08-09 15:28:08.097: E/ERROR(838): org.jivesoftware.smack.SmackException$ConnectionException

08-09 15:28:08.097: E/ERROR(838):           at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPC onnection.java:433)

08-09 15:28:08.097: E/ERROR(838):           at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection. java:808)

08-09 15:28:08.097: E/ERROR(838):           at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:396)

08-09 15:28:08.097: E/ERROR(838):           at com.example.multichat.MainActivity.onCreate(MainActivity.java:35)

08-09 15:28:08.097: E/ERROR(838):           at android.app.Activity.performCreate(Activity.java:5047)

08-09 15:28:08.097: E/ERROR(838):           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)

08-09 15:28:08.097: E/ERROR(838):           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)

08-09 15:28:08.097: E/ERROR(838):           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)

08-09 15:28:08.097: E/ERROR(838):           at android.app.ActivityThread.access$700(ActivityThread.java:134)

08-09 15:28:08.097: E/ERROR(838):           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)

08-09 15:28:08.097: E/ERROR(838):           at android.os.Handler.dispatchMessage(Handler.java:99)

08-09 15:28:08.097: E/ERROR(838):           at android.os.Looper.loop(Looper.java:137)

08-09 15:28:08.097: E/ERROR(838):           at android.app.ActivityThread.main(ActivityThread.java:4867)

08-09 15:28:08.097: E/ERROR(838):           at java.lang.reflect.Method.invokeNative(Native Method)

08-09 15:28:08.097: E/ERROR(838):           at java.lang.reflect.Method.invoke(Method.java:511)

08-09 15:28:08.097: E/ERROR(838):           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007 )

08-09 15:28:08.097: E/ERROR(838):           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)

08-09 15:28:08.097: E/ERROR(838):           at dalvik.system.NativeStart.main(Native Method)

Outcomes