客户端无法建立与本地地址localhost:3000
的连接。
遇到的错误是:
dial tcp [::1]:3000: connectex: No connection could be made because the target machine actively refused it.
我该如何解决?
答案 0 :(得分:0)
答案 1 :(得分:0)
在模拟器上,可以使用IP 10.0.2.2 访问本地主机。
因此,localhost:3000
将在您的模拟器中成为10.0.2.2:3000
。
首先,您必须位于同一网络上才能连接。
ipconfig
(Windows)和ip a
或ifconfig
(Linux)获取PC ip 192.168.2.121:3000
(您的防火墙必须可以这样做)如果您尝试使用代码进行连接,则需要做同样的事情