Hi there,
I'm using the ESP8266-12 module working as standalone CPU, I mean, with the Arduino sketch running inside it; I have just designed a system on which this module acts either as local server, or as a client for remote servers, exclusivelly ( I mean, one task per time ).
THE PROBLEM IS:
When I compile the code with the following statements, the module is able to work as local server:
WiFi.begin ( ssid , password ) ;
WiFi.config ( net , gateway , subnet ) ;
However, this works as client only if I compile again, now omitting the Gateway/Subnet settings:
WiFi.begin ( ssid , password ) ; // omitting further gateway configuration
I'm using the following networking libraries:
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
I even thought about disconnecting and reconnecting the Wifi so that I could now configure it according to the target usage, but this solution seems a bit radical, since a priori network settings should be able to be configured in runtime ( at least this is possible in operating systems ).
So, the question which arose:
- How to disable Gateway Wifi settings in runtime ?
See bellow an illustration of what I'm talking about: