BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Port forwarding in 2020

Hello everyone, I have created a local server and everything works perfectly. Now I have to expose the server to the internet. Which ports I need to expose for a full working server? I looked some old discussions but it looks that blynk server ports changed during time. Sorry for my bad english.
Greetings from Italy,
Nicola Lorenzini

To use your device running the app outside of the home WiFi network you need to forward port 9443 and either have a static public IP address or use a DDNS service and run an updater on a device within your home network.

The alternative is to use ZeroTier to create a virtual network and add your server and your phone to this network. In that way no port forwarding or DDNS is needed and you have a way to remotely manage your server at the same time.

Pete.

Hi Pete. Thank for tour reply. I already have a DDNs service. I only have to open Port 9443?

If the device will connect to you from another network, then I think that you need to redirect the port 8080.

Yes, if your Arduinos/NodeMCU’s etc that are connecting to the server are within your own network then just port 9443 is needed.

But as @Un_ka has said, if these devices are outside your network then you’ll need to open port 8080 as well - and specify your DDNS URL and port 8080 in your sketch.

Pete.

Thank you all! I Will try as sono as possibile.
Nicola.
PS. How can I change URL and Port in Arduino sketch?

Are you using Blynk.begin or Blynk.config?

Pete.

I use blynk begin. Should I use Blynk.config?

It depends on your use case.
Blynk.begin is a blocking function, so the code will never proceed beyond that point if a connection to either the WiFi network or Blynk server can’t be established.
If, for example, you have a device which has a pushbutton that provides manual on/off control for a relay as well as Blynk control over the relay then you would want the pushbutton to work regardless of whether you had a WiFi/Blynk connection.
In that situation, you would want to use Blynk.Config and Blynk.Connect - but you would also need to manually configure the WiFi connection.

The syntax for Blynk.begin with a remote server URL and port 8080 is:

Blynk.begin(auth, ssid, pass,"Your_DDNS_URL", 8080);

Pete.

Thank you all! I will try as soon as possible if it works!
Nicola.