且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何让简单的android客户端和PC服务器获得工作

更新时间:2022-06-27 00:20:53

您可能使用一台路由器/无线接入点连接到互联网?

You probably use a router/wifi-access-point to connect to internet?

如果您的路由器使用 NAT协议,那么互联网无法打开connectio在任何设备您的PC。 NAT只允许PC打开连接到互联网,而不是相反。

If your router uses NAT protocol, then any devices on the Internet can not open connectio to your PC. NAT only allows PC to open connection to the internet and not vice-versa.

所以,当您的手机上的WiFi它可以连接到PC,因为它们都是在同一个网络上,并没有使用NAT。当您的手机是3G的,因此互联网的,比有NAT在两者之间的手机和PC。

So when your phone is on wifi it can connect to PC because they are both on the same network and NAT is not used. When your phone is on 3g, and hence of the internet, than there is NAT in-between your phone and your PC.

解决方案:

你的路由器上启用端口转发,比你的应用程序路由器的IP,这将转发此连接到您的电脑连接。

Enable port forwarding on your router, than connect with your app to router's IP which will forward this connection to your PC.