java - Unable to connect to internet, Connection Refused -
i have massive problem. unable connect java server-socket android emulator. have got log , code:
i using version 2.1 (eclair) emulator run android application.
system.out.println("sup"); try{ socket socket = new socket("127.0.0.1", 26753); printwriter out = new printwriter(socket.getoutputstream(), true); out.println("e:ask"); out.println("p:pass"); out.println("eof"); socket.close(); } catch (exception e){ e.printstacktrace(); }
logcat errors:
05-02 21:35:41.986: i/system.out(276): sup 05-02 21:35:41.996: w/system.err(276): java.net.connectexception: /127.0.0.1:26753 - connection refused 05-02 21:35:41.996: w/system.err(276): @ org.apache.harmony.luni.net.plainsocketimpl.connect(plainsocketimpl.java:255) 05-02 21:35:41.996: w/system.err(276): @ org.apache.harmony.luni.net.plainsocketimpl.connect(plainsocketimpl.java:220) 05-02 21:35:41.996: w/system.err(276): @ java.net.socket.startupsocket(socket.java:780) 05-02 21:35:41.996: w/system.err(276): @ java.net.socket.tryalladdresses(socket.java:192) 05-02 21:35:42.006: w/system.err(276): @ java.net.socket.<init>(socket.java:256) 05-02 21:35:42.006: w/system.err(276): @ java.net.socket.<init>(socket.java:220) 05-02 21:35:42.006: w/system.err(276): @ testclass.skytheventure.testclass.onclick(testclass.java:38) 05-02 21:35:42.006: w/system.err(276): @ android.view.view.performclick(view.java:2364) 05-02 21:35:42.006: w/system.err(276): @ android.view.view.ontouchevent(view.java:4179) 05-02 21:35:42.006: w/system.err(276): @ android.widget.textview.ontouchevent(textview.java:6541) 05-02 21:35:42.006: w/system.err(276): @ android.view.view.dispatchtouchevent(view.java:3709) 05-02 21:35:42.006: w/system.err(276): @ android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 05-02 21:35:42.006: w/system.err(276): @ android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 05-02 21:35:42.006: w/system.err(276): @ android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 05-02 21:35:42.016: w/system.err(276): @ android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 05-02 21:35:42.016: w/system.err(276): @ com.android.internal.policy.impl.phonewindow$decorview.superdispatchtouchevent(phonewindow.java:1659) 05-02 21:35:42.016: w/system.err(276): @ com.android.internal.policy.impl.phonewindow.superdispatchtouchevent(phonewindow.java:1107) 05-02 21:35:42.016: w/system.err(276): @ android.app.activity.dispatchtouchevent(activity.java:2061) 05-02 21:35:42.016: w/system.err(276): @ com.android.internal.policy.impl.phonewindow$decorview.dispatchtouchevent(phonewindow.java:1643) 05-02 21:35:42.016: w/system.err(276): @ android.view.viewroot.handlemessage(viewroot.java:1691) 05-02 21:35:42.016: w/system.err(276): @ android.os.handler.dispatchmessage(handler.java:99) 05-02 21:35:42.016: w/system.err(276): @ android.os.looper.loop(looper.java:123) 05-02 21:35:42.016: w/system.err(276): @ android.app.activitythread.main(activitythread.java:4363) 05-02 21:35:42.016: w/system.err(276): @ java.lang.reflect.method.invokenative(native method) 05-02 21:35:42.027: w/system.err(276): @ java.lang.reflect.method.invoke(method.java:521) 05-02 21:35:42.027: w/system.err(276): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:860) 05-02 21:35:42.027: w/system.err(276): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:618) 05-02 21:35:42.027: w/system.err(276): @ dalvik.system.nativestart.main(native method)
do need more permissions?
127.0.0.1 ip of emulator. 10.0.2.2 looking (the host emulator running on)
Comments
Post a Comment