10.0.2.2 is an emulator-only alias to your computer. the address is 
not valid from a real device, unless the DHCP server is giving out 
addresses in that range.

in order to connect to a server running on your computer from a real 
phone, you'll have to determine its name or IP address and connect to 
that.

this works, i do it all the time.

hth

>Hi Experts,
>
>i am working on a client server program in android.
>i have a Main java class running on my pc as a server socket listening
>to the port 8626 and i am trying to connect android client (on real
>device ) to that server.
>
>Socket socket =   new Socket(IP , 8626 );
>
>i tried my local ip and it gives me no route to host exception
>please suggset which ip i need.
>
>if i use ip 10.0.2.2 and run on emulator it succeeds but not on real
>device.
>
>client and server both are on same pc, and android device is attached
>to my pc as well.
>
>plz help
>

-- 
jason.software.particle

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to