How To Connect to a Public IP

lfm_
Posts: 3
Joined: Wed Sep 06, 2017 8:25 pm

How To Connect to a Public IP

Postby lfm_ » Wed Sep 06, 2017 8:40 pm

Hello,


I'm trying to make a connection on my public IP and I'm not getting it, but if I connect to a local machine, it works.

This is the code i am using:

Code: Select all

internet.println("AT+RST");
delay(2000);
internet.println("AT+CWMODE=3");
delay(100);
internet.println("AT+CWJAP=\""+ network +"\",\""+ password +"\"");
delay(2000);
internet.println("AT+CIFSR");

internet.println(""AT+CIPSTART=\"TCP\",\""  + IP + "\"," + Port")


If I connect to a local IP, it works, if I try to connect to my server in the cloud the return is ERROR CLOSED.

What should I do?

User avatar
pratik
Posts: 467
Joined: Wed Jun 29, 2016 7:17 pm
Location: India
Contact:

Re: How To Connect to a Public IP

Postby pratik » Wed Sep 06, 2017 9:59 pm

You should directly try the website name instead of the IP address. If you use IP address, then the connection will be made with a device within the subnet (local addresses by default).
So instead of connecting to, for example, 192.168.1.104 @port: 80
You can try www.yourcloudserver.com @whichever port you want
Regards,
Pratik Panda
Website: http://www.PratikPanda.com

Custom firmware, Knowledge base and freelancing (ESP8266/ESP32):
http://www.iot-bits.com

lfm_
Posts: 3
Joined: Wed Sep 06, 2017 8:25 pm

Re: How To Connect to a Public IP

Postby lfm_ » Wed Sep 06, 2017 10:35 pm

Thanks for the answer...

I've also tried the website, however how much do I try this way returns DNS FAIL

Did I configure it wrong?

lfm_
Posts: 3
Joined: Wed Sep 06, 2017 8:25 pm

Re: How To Connect to a Public IP

Postby lfm_ » Thu Sep 07, 2017 2:29 am

After updating the firmware, the connection was possible through the public IP.

Thank you very much

User avatar
pratik
Posts: 467
Joined: Wed Jun 29, 2016 7:17 pm
Location: India
Contact:

Re: How To Connect to a Public IP

Postby pratik » Thu Sep 07, 2017 2:38 pm

Ohh, probably a firmware issue with some old version. Glad it worked!
Regards,
Pratik Panda
Website: http://www.PratikPanda.com

Custom firmware, Knowledge base and freelancing (ESP8266/ESP32):
http://www.iot-bits.com

Who is online

Users browsing this forum: No registered users and 1 guest