When using the Arduino IDE and the ESP8266 we declare a global WiFiServer before the setup() code like this:
WiFiServer myServer(0); // to be changed later at run-time
and later in the setup code or in the loop code we could change the listening port like this:
This is useful when the port number for TCP communication is not previously defined or when it is defined by the user during a setup phase.
Unfortunately this does not work with the ESP32. If we do the same we got this error:
no matching function for call to 'WiFiServer::begin(unsigned int&)'
I wonder if there is a way to bypass this problem without "à priori" fixing the port number.