In the development, sometimes we need to send remotely, or through 3G and 4G, or other WiFi environment to send a small amount of data, and do not want to spend so much cost to develop a cloud server, this time the emergence of a router to expose an intranet IP for external network access. In fact, the implementation name of this method is called port mapping .
Next we implement this way ready you want to expose the intranet IP address and port number , as well as your public network IP address ( public network IP address query is easy, in Baidu input: IP, enter, is your public address of the network )
When you're ready, then we'll go into your routing manager, the address is usually 192.168.1.1, and the following is the interface after the entry
Then we enter the port mappings in the network settings, making configuration-related parameters, as shown in figure:
The above settings have been written in great detail, then your program in the external network can be connected via sockets ( public IP, you want to expose the port number ) to connect. After the realization, smart careful to understand, such a port mapping, in fact, the approximate meaning is that you want to expose the intranet IP and port number, change is only the intranet IP. Such a mapping is the public network IP instead of the intranet in the IP, port number or original, no change .
In fact, routers can implement this requirement, but it is recommended that this approach is only suitable for transferring small amounts of data with low security . If your needs are to transmit a large amount of data, security needs to be high, then this implementation is not appropriate.