Cannot modify the port forwarding to ESP server

francinnov
Posts: 6
Joined: Tue Nov 06, 2018 9:07 am

Cannot modify the port forwarding to ESP server

Postby francinnov » Thu Nov 22, 2018 7:48 pm

Hello everybody,

In my code, I use my ESP32 as a server to receive HTTP request from a client server.
What I'm trying to do : I want to change the listening port of my ESP32 server. But when I change this port, nothing work anymore...

Of course I have entered the port forwarding in my router.

Would you have an idea ?

This the function member of my class :

Code: Select all

bool EspComPI::checkOrderFromPI(){
  WiFiClient client = _wifiServer.available();

  if (client) {
  Serial.println("Order from RPI");

    while (client.connected()) {
    //Serial.println("Client connecté");
 
      while (client.available()>0) {
        //Serial.println("Client envoie");  
        this->order_pi = client.read();
        client.write(this->order_pi);
        //Serial.print("Mess serveur RPI :");Serial.println(this->order_pi);
      }
 
      delay(10);
    }
 
    client.stop();
    //Serial.println("Client disconnected");
    return true;
  }  
  return false;
}
With in the header :

Code: Select all

WiFiServer _wifiServer;
Thank you for your advice! :D

User avatar
martinayotte
Posts: 141
Joined: Fri Nov 13, 2015 4:27 pm

Re: Cannot modify the port forwarding to ESP server

Postby martinayotte » Thu Nov 22, 2018 8:24 pm

Simply change "WiFiServer _wifiServer;" to "WiFiServer _wifiServer(8080);" for example ...

Who is online

Users browsing this forum: No registered users and 90 guests