ESP8266 Internet connection

How do I connect ESP8266 to the global network? I can make it get IP an address and in one Wi-Fi network I can manage it(95% of the examples on the Internet), but if I need to connect to ESP from the other end of the Earth? I would like to connect it to my site or at least make it an address from which you can manage it regardless of location. I plan to do all the management with GET requests

Author: insolor, 2017-06-12

2 answers

It is better to manage such a thing via tcp or trap udp polling.

The essence of poling is that the piece of iron makes a request to the server. The server opens the connection and sleeps until the command appears. The command is sent to the connection and the device receives it or waits for the next command or makes a reconnect. Here you should take into account the timeouts and reconnect before the connection is lost.

The essence of the ladder in udp is that the piece of iron periodically sends packets "I'm here" to the server. The packet passing through the router opens the port and the response with the command will return on the same path as it left.

Port forwarding should not be done. The main reason is that the network stack on the controller is single-threaded and the scanned bot will take up the hardware. I once "lost"my online sales register.

 1
Author: eri, 2019-01-25 22:21:15

The Internet router to which the device is connected manages the subnet, and is itself part of a certain subnet.

For example, in your network, the device has an address of 192.168.1.100, and the subnet mask looks like this-192.168.1.255.

And the router itself has for example 93.185.19.103, and its subnet mask looks like this-93.185.19.255.

So the external address of your device will be, for example, 93.185.19.104.

The Internet has a hierarchical structure. The fact is that all messages, those that are addressed to a device in a subnet receive all devices in that subnet, and they simply ignore packets that are not addressed to them.

And if you set a static IP that is not addressed by the subnet mask of your device, then the packets coming from it will only receive the devices connected to your local network, and the router will ignore them, since these are packets that are physically transmitted over its network, but logically they are packets from another subnet.

 0
Author: Vanyamba Electronics, 2017-06-13 02:04:46