Worked fine using my home network. However, I wanted the server ESP8266 to be an access point, so I included the ESP8266WebServer.h library.
Once I did that I got an error 'class ESP8266WebServer' has no member named 'available' on the line WiFiClient client = server.available();. It seems it is accessing the wrong library, ESP8266WebServer, instead of ESP8266WiFi.h. I have included the code here stripped down to the essentials:
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
ESP8266WebServer server(50009);
const char *ssid = "SomeSSID";
const char *password = "SomePassword";
void setup() {
WiFi.softAP(ssid, password);
WiFi.mode(WIFI_AP);
server.begin();
}
void loop() {
//listen for incoming server
WiFiClient client = server.available();
if (!client){
return;
}
//do something here
//close connection
client.stop();
}
Any help will be appreciated. Thanks.