Can not (half) access from the internet

Hey guys im very frustrated at the moment.

I tried to make a small Server with Esp8266. If i pot the port in “WiFiServer server();” to 80 i can access the site from my local WiFi if i change it e.g. to 88 there is no chance to access it.
Now opened port 8080 to 80 (or whatever to what i set up) on my router. If i use this Open Port Check Tool - Test Port Forwarding on Your Router to check wehter the port is open it say yes and i see it in the serial monitor that something connected. Also when it is a different port then 80. So in conclusion I can access the site from my local network just on port 80 and never from outside just the website can.
Why? ;(( its so weird

/*#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>

// Replace with your network credentials
const char* ssid = "Hybrid2017";
const char* password = "*****";
*/
#include <ESP8266WiFi.h>
const char* ssid = "Hybrid2017";
const char* password = "2193907354499390";

WiFiServer server(80);


void setup()
{
  Serial.begin(115200);
  Serial.println();

  Serial.printf("Connecting to %s ", ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println(" connected");

  server.begin();
  Serial.printf("Web server started, open %s in a web browser\n", WiFi.localIP().toString().c_str());
}


// prepare a web page to be send to a client (web browser)
String prepareHtmlPage()
{
  String htmlPage =
     String("HTTP/1.1 200 OK\r\n") +
            "Content-Type: text/html\r\n" +
            "Connection: close\r\n" +  // the connection will be closed after completion of the response
            "Refresh: 10\r\n" +  // refresh the page automatically every 5 sec
            "\r\n" +
            "<!DOCTYPE HTML>" +
            "<html>" +
            "Analog input:  " + String(analogRead(A0)) +
            "</html>" +
            "\r\n";
  return htmlPage;
}


void loop()
{
  WiFiClient client = server.available();
  // wait for a client (web browser) to connect
  if (client)
  {
    Serial.println("\n[Client connected]");
    while (client.connected())
    {
      // read line by line what the client (web browser) is requesting
      if (client.available())
      {
        String line = client.readStringUntil('\r');
        Serial.print(line);
        // wait for end of client's request, that is marked with an empty line
        if (line.length() == 1 && line[0] == '\n')
        {
          client.println(prepareHtmlPage());
          break;
        }
      }
    }
    delay(1); // give the web browser time to receive the data

    // close the connection:
    client.stop();
    Serial.println("[Client disonnected]");
  }
}

Hey guys im very frustrated at the moment.

I tried to make a small Server with Esp8266. If i pot the port in "WiFiServer server();" to 80 i can access the site from my local WiFi if i change it e.g. to 88 there is no chance to access it.
Now opened port 8080 to 80 (or whatever to what i set up) on my router. If i use this Open Port Check Tool - Test Port Forwarding on Your Router to check wehter the port is open it say yes and i see it in the serial monitor that something connected. Also when it is a different port then 80. So in conclusion I can access the site from my local network just on port 80 and never from outside just the website can.
Why? ;(( its so weird


DON'T CROSS POST!!!!!!!!!!!!!!!!!!!!

I HAVE REPORTED THIS THREAD TO THE MODERATORS

sorry did not know where it fit

If you want to have a thread moved to a different forum section you can click the "Report to moderator" link at the bottom of the post and ask nicely for it to be moved. However, it's better to take the time to find the best forum section before posting because the moderators already have plenty of work dealing with spam.

ok thank you

When you tried to set the port to 88 did you change the local URL to match?

eg if your previous URL was

http://192.168.1.1 (uses port 80 by default)

Then you need to change it to

http://192.168.1.1:88 (specify port 88)

Making it accessible from outside your LAN involves changes to your router. If you say that that you see something in the serial monitor when connecting from outside can you please post it (use the code tags).

/code]
[/quote]

pert:
DON'T CROSS POST!!!!!!!!!!!!!!!!!!!!
http://forum.arduino.cc/index.php?topic=522134
I HAVE REPORTED THIS THREAD TO THE MODERATORS

Jeeesus pal! Is really necessary to be so agro with a newby >:(

A gentle suggestion would be the polite thing to do!

AlexTest:
Hey guys im very frustrated at the moment.

I tried to make a small Server with Esp8266. If i pot the port in "WiFiServer server();" to 80 i can access the site from my local WiFi if i change it e.g. to 88 there is no chance to access it.
Now opened port 8080 to 80 (or whatever to what i set up) on my router. If i use this Open Port Check Tool - Test Port Forwarding on Your Router to check wehter the port is open it say yes and i see it in the serial monitor that something connected. Also when it is a different port then 80. So in conclusion I can access the site from my local network just on port 80 and never from outside just the website can.
Why? ;(( its so weird


192.168.20.34:88

That is how you would gain remote access the http interface of the device assuming you have port forwarded correctly to port 88 in your ADSL modem settings. I.E. Local port should be 80 while the public access port should be 88.

Oh and replace '192.168.20.34' with what ever your public IP address as seen in your ADSL modem settings.

Check if your ISP blocks access to port 80. Because mine does!!!

With Comcast where I am, outside ports need to be opened not just in router but modem too ( through the web c9ntrol panel) - this could be your issue.

That said, I would never let the world connect to some IoT device I programmed - if have a server in the cloud that it reached out to instead

Thank you i was able to reach the site even when I switch the ports but I am still not able to reach ist from the outside. I set the server to 88 and on my router I selected the esp and tried 80 to 88 and 88 to 80 on TCP it did not work.

Another Question is there a good documentation of the wifif libraries (<ESP8266WiFi.h>,<WiFiClient.h>,<ESP8266WebServer.h>) with any other thing i came a head. But the wifi stuff is killing me right know.

server.send(200, "text/plain", "Hello world")
server.on(" / other", []() {
 
    server.send(200, "text / plain", "Other URL");

what does the 200 do?
why are and () needed

and so much other stuff on which i cant find documentation. For a beginner with zero knowledge of networks, electronics and serve and programming it is pretty hard without a good documentation.

The idea is that the library API will follow the Arduino WiFi library so you can use that documentation:
https://www.arduino.cc/en/Reference/WiFi
and everything different is documented here:
https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/readme.html

Unfortunately I find that to be lacking still and frequently am left with whatever I can glean from the example sketches and the source code.

AlexTest:
why are and () needed

Where did you find that code?

Unfortunately, some ESP8266 examples try to teach C++ by example. Here is an example.

[ur]https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WebServer/examples/HelloServer/HelloServer.ino[/url]

server.on("/inline", [](){
    server.send(200, "text/plain", "this works as well");
  });

The usual way to do this to use a real function.

void handle_inline() {
  server.send(200, "text/plain", "this works as well");
}

...

server.on("/inline", handle_inline);

In the example, the author decided to demonstrate the way expert C++ coders avoid creating a short function by including the function body "inline" as a parameter to another function. Clever but obscure. This is not to be confused with the inline keyword. I think "" means create a function with no name and the body of the function follows. I am not a C++ expert so I am not sure what this is called. In Javascript, these are called anonymous functions.

AlexTest:
server.send(200, "text / plain", "Other URL");[/code]

what does the 200 do?

From the ESP8266WebServer library source code:

 // send response to the client
  // code - HTTP response code, can be 200 or 404
  // content_type - HTTP content type, like "text/plain" or "image/png"
  // content - actual content body
  void send(int code, const char* content_type = NULL, const String& content = String(""));
  void send(int code, char* content_type, const String& content);
void send(int code, const String& content_type, const String& content);

So 200 is the HTTP response code.

From HTTP/1.1: Status Code Definitions

10.2.1 200 OK

The request has succeeded. The information returned with the response is dependent on the method used in the request, for example:

GET an entity corresponding to the requested resource is sent in the response;

HEAD the entity-header fields corresponding to the requested resource are sent in the response without any message-body;

POST an entity describing or containing the result of the action;

TRACE an entity containing the request message as received by the end server.