Click here to Skip to main content
15,892,269 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i develop asp web application and android application
asp server is running on port 6100
i use my android device for debugging
and when i run two programs i got exception in android app said network is unreachable although i used 10.0.2.2:6100 in android app
i search for problem and i found the sloution may be the port forwarding
i write the command in adb as
adb forward tcp:6100 tcp:5000
and there is problem : cannt bind socket
i change the command to
adb forward tcp:5000tcp:5000
and it run, but android app still said network is unreachable
can anyone help me please?.........
Posted

1 solution

I'm going to have to guess at this one because I'm not sure I understand what the problem is.

If you saying under the emulator this works and on your phone connected via usb it doesn't it's because 10.0.2.2 is a special loop back for the emulator and not the phone. Change the phone to 127.0.0.1 or give the android app the address of the asp web server.

My understanding is there is no usb tether by default under Android, but it can be done. reverse-usb-tethering-with-android[^] explains how it can be done.

Maybe this helps, I hope so

/Darren
 
Share this answer
 
Comments
tarekwarak0 24-Apr-12 5:16am    
the address 127.0.0.1 display connection refused
i turn off the antivirus and firewall
and the message is also displayed
i go to posted link and the website said you must be root and i'm not
Thank you very much, maybe my question becomes more clear
Darren_vms 24-Apr-12 7:00am    
so you need to get a network between the phone and website, wireless or 3g and change the address to that of the webserver
tarekwarak0 24-Apr-12 11:12am    
my web server is local ( in my pc )
and i need to request my local web server from android phone over usb
using http protocol
i hope it will be clear
Darren_vms 24-Apr-12 7:12am    
http://www.codeproject.com/Articles/191930/Android-Usb-Port-Forwarding might be worth a read
tarekwarak0 24-Apr-12 11:10am    
thank you Darren_vms
but, i need to be root to do reverse tethering : i will do that

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900