I put the right ip and port (work well on pc using Spark) into ConnectionConfigration ,but running in android ,when connect to server ,it throw SmackException$ConnectionException,log :
07-04 22:28:59.654: W/System.err(6538): org.jivesoftware.smack.SmackException$ConnectionException
07-04 22:28:59.656: W/System.err(6538): at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPC onnection.java:431)
07-04 22:28:59.656: W/System.err(6538): at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection. java:799)
07-04 22:28:59.656: W/System.err(6538): at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:391)
07-04 22:28:59.656: W/System.err(6538): at com.zyx.myim.MainActivity.onLogin(MainActivity.java:40)
07-04 22:28:59.656: W/System.err(6538): at java.lang.reflect.Method.invokeNative(Native Method)
07-04 22:28:59.656: W/System.err(6538): at java.lang.reflect.Method.invoke(Method.java:511)
07-04 22:28:59.657: W/System.err(6538): at android.view.View$1.onClick(View.java:3593)
07-04 22:28:59.657: W/System.err(6538): at android.view.View.performClick(View.java:4091)
07-04 22:28:59.657: W/System.err(6538): at android.view.View$PerformClick.run(View.java:17072)
07-04 22:28:59.657: W/System.err(6538): at android.os.Handler.handleCallback(Handler.java:615)
07-04 22:28:59.657: W/System.err(6538): at android.os.Handler.dispatchMessage(Handler.java:92)
07-04 22:28:59.658: W/System.err(6538): at android.os.Looper.loop(Looper.java:153)
07-04 22:28:59.658: W/System.err(6538): at android.app.ActivityThread.main(ActivityThread.java:5000)
07-04 22:28:59.658: W/System.err(6538): at java.lang.reflect.Method.invokeNative(Native Method)
07-04 22:28:59.658: W/System.err(6538): at java.lang.reflect.Method.invoke(Method.java:511)
07-04 22:28:59.659: W/System.err(6538): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
07-04 22:28:59.659: W/System.err(6538): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
07-04 22:28:59.659: W/System.err(6538): at dalvik.system.NativeStart.main(Native Method)
I debug to the XmppTcpConnection.connectUsingConfiguration(),and find out that config has the ip and prot data ,but parse in the end ,the host is null,and port is 0,so throw that exception(see the attach picture),but why,can someone help me?
asmack SmackException$ConnectionException