0

I am developing simple android app. In emulator its running fine but when I am trying to run in the mobile device, its giving OSNetworkSystem_connect fail: Timeout error. I have googled for solution but didn't get any useful info. anybody please tell me what am I doing wrong? I am using web services with ksoap2, apache and mysql databse Thanks in advance

Here is the my Logcat details

03-14 17:12:17.932: I/System.out(15535): [socket][0] connection 10.0.2.2/10.0.2.2:8085;LocalPort=57976(20000)
03-14 17:12:17.932: I/System.out(15535): 10.0.2.2/10.0.2.2:8085(20000)
03-14 17:12:17.932: I/OSNetworkSystem(15535): OSNetworkSystem_connect fd=-1; timeout = 20000
03-14 17:12:37.949: E/OSNetworkSystem(15535): OSNetworkSystem_connect Fail:Tiemout
03-14 17:12:37.951: I/System.out(15535): [socket][1:57976] exception
4

1 に答える 1

0

It looks like you have server running on the same machine as emulator. 10.0.2.2 is a special IP that should be used to connect server from running on the same machine as the emulator.

To access the server using 3G on device you need to host server on publicly accessible server and use the public ip in your code to connect to server..

Other option would be to put your machine running the server and phone on the same wifi network so that they are on same LAN and then use the ip provided to machine to connect to server from the device...

于 2013-03-14T11:51:28.150 に答える