How to connect esp8266 to a local server if on a different network

How to connect esp8266 to a local server with a dedicated Ip if he is on a different network?
Blynk.begin(auth, ssid, pass, IPAddress (xxx,xxx,xxx,xxx));
what else?
(xxx,xxx,xxx,xxx) - allocated ip.

Just forward the ports for your local server and use the public IP instead of local IP.

the port forwarding I did and can connect to the server from outside. But do not know how to specify the port in the sketch, tried 9443 - is not working. And how to set the port in the sketch help?

You treat is as if it was any other “Local Server”… only you use the Public IP of wherever your Local Server is setup, and whatever external Port you used for the port forwarding…

I.e. Public IP XXX.XXX.XXX.XXX and assuming you setup port forwarding as 4321(external) forwarding to xxx.xxx.xxx.xxx:8442(internal)

Blynk.begin(auth, ssid, pass, "XXX.XXX.XXX.XXX", 4321); // Use the Public IP and Port of the Local Server location 

Use a proper external port number or even keep it the same 8442 - 8442

Server uses ports 8443 (for app), 8442 (for hardware without ssl), 8441 (for hardware with ssl).

Port 9443 (for https, web sockets & admin port).

1 Like