Android HttpClient sends request to host computer via USB

I have an Android application running on a phone connected to the host machine via USB. The phone will always be connected to the device, and I need to send an HTTP request to the device. While working in the emulator, I can access the web server running on the computer using the IP address 10.0.2.2, and this works fine. However, by running the same application on the phone, I get a SocketException from Network unreachable . The phone does not have a SIM card in it and does not have Wi-Fi connection, I need an HTTP request to just transfer the USB to the computer. Is it even possible? If so, what am I doing wrong.

I use the standard HttpClient code, nothing special that works absolutely fine if I run it on the phone using a Wi-Fi connection, so I know this is not a problem.

+5
android networking usb
source share
3 answers

As a result, I refused this and basically polled the phone for new content that I wanted to get from the computer using adb .

+2
source

Reverse Binding! not sure if it works. I have never tried. This thread can help:

https://android.stackexchange.com/questions/2298/how-to-set-up-reverse-tethering-over-usb

+1
source

This app for Android + Windows host should do the trick:

http://www.codeproject.com/KB/android/UsbPortForwarding.aspx

0
source

All Articles