【发布时间】:2021-06-03 13:45:53
【问题描述】:
我正在尝试通过我的手机上的 http 侦听器从我的台式计算机向 Unity 应用发出发布请求。
Unity 应用程序侦听 0.0.0.0:4444。我通过我的 python 应用程序使用
x = requests.post("http://192.168.0.98:4444", data = somestring))
192.168.0.98 是我手机的 IP 地址。两个设备连接到同一个网络。我已经尝试过 - 打开 USB 调试,通过 adb 和 6 位配对码配对设备,通过 adb 连接设备以及此处的说明https://developer.android.com/studio/command-line/adb#wireless。
当我在与 python 代码相同的计算机上的桌面上运行 Unity 时,该应用程序运行良好,但是当我在手机上运行它时,我的 python 代码遇到了。
HTTPConnectionPool(host='192.168.0.98', port=4444): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000253FEB996A0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))
【问题讨论】: