简体   繁体   English

从 android 设备向 PC 上的 nodejs 本地服务器发送 http 请求

[英]sending http requests from android device to nodejs local server on PC

I'm trying to send http requests from my flutter app using android device to a local server on my pc and I've set the address of url to the actual ip address of my pc and also both my device and pc is connected to the same network but yet I could not complete the task and the app still not able to send any http request I'm trying to send http requests from my flutter app using android device to a local server on my pc and I've set the address of url to the actual ip address of my pc and also both my device and pc is connected to the相同的网络,但我无法完成任务,应用程序仍然无法发送任何 http 请求

how to fix this problem如何解决这个问题

If you want to communicate with the localhost on your machine and you are building your App on an Android emulator, on the android emulator, you must use: http://10.0.2.2:{yourPort}如果您想与机器上的 localhost 通信,并且您正在 Android 模拟器上构建您的应用程序,那么在 android 模拟器上,您必须使用: http://10.0.2.2:{yourPort}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM