Connect esp to port-forwarded server form external network

Is it possible to connect my esp8266 to an external portforwarded server?
I’ve got my own local server, but I want to connect to this server from another network.
My server is port-forwarded so I can use the app from anywhere, but I want my microcontrollers to connect to this same server from another network.
This does not seem to work.

Blynk.begin(auth, "xxxxx", "xxxxx", IPAddress(xx,xx,xxx,xx)); *External IP*

Do u have static IP?

Yes. My blynk server has a static ip.

So set up dns for it then. www.ddns.net. Also check if u have opened HW ports.

@wiipro as @hutje has a static ip then ddns wouldn’t be needed, just call the IP.

yes, but in my opinion ddns is more practical, as it is easier to remember and u didnt need to reflash code in case of IP change.

I can remember my external IP good enough. Only when I try to let my esp connect to my server at home, he can’t connect.

So for example, my external IP is 23.45.183.14 (it is fake) and my server has a static ip 192.168.1.107.
What do I need to type in the code?

I tried by using the external ip but then he got stuck by connecting to the blynk server.

@hutje have you forwarded the 3 required ports of 8443, 8442. 8441?

Then it is:

char server[] = "23.45.183.142";  // or "youpick.ddns"

Blynk.begin(auth, ssid, pwd, server);
Blynk.begin(auth, "xxxxx", "xxxxx", "23.45.183.14");

try to do it like this. I’m using it in this way.

Also, if you want to save RAM do it like this:

#define SSID "ur_ssid"
#define PASS "ur_pass"
#define server "ur_ip"
Blynk.begin(auth, SSID, PASS, server);