How can I initiate an Android-to-PC HTTP request over USB?

前端 未结 5 1269
耶瑟儿~
耶瑟儿~ 2021-02-01 10:11

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

5条回答
  •  时光取名叫无心
    2021-02-01 11:00

    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"

提交回复
热议问题