This has been asked before, but did not receive a satisfactory answer.
From my Android application, I need to send an HTTP request to a PC attached via USB. Typ
Unfortunately, you cannot send HTTP requests over a local socket, such as /dev/tty... or alike. By default, the android device, if it acquires an IP address, will have done so via DHCP or a static IP you have set. What you would need to do, is know the IP of the desktop computer.
What are you actually trying to accomplish? Having the application send a request to localhost, which would relay to the PC?
This answer may help "find the ip of desktop over usb tethering"