Skip to content

Web server hosted on ESP8266 is not responding when it is not connected to home wifi #1754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
indexpert opened this issue Mar 11, 2016 · 1 comment

Comments

@indexpert
Copy link

Basic Infos

ESP hosted web server is not responding when ESP is not connected to home wifi.

Hardware

Hardware: ESP-1
Core Version: ?2.1.0-rc2?

Description

Problem description
I am trying to build a basic app in which multiple ESPs will request their status to 1 ESP (like STAR schema). below are two kind of ESPs in my project:

  1. ESP monitor: AP_STA + hosted web server + sends HTTP post to internet for sync itself

  2. ESP clients : Connected via ESP Monitor n/w+ Send HTTP GET request to ESP monitor.

it is working perfectly fine when ESP monitor is got connected to my home WIFI. But if i switched off my home WIFI, ESP clients are not getting any response from ESP Monitor while clients are able to connect to ESP Monitor n/w.

Settings in IDE

Module: Generic ESP8266 Module
CPU Frequency: 80Mhz

Sketch

include <ESP8266WiFi.h>

include <ESP8266WebServer.h>

include <ESP8266WiFiMulti.h>

include <ESP8266HTTPClient.h>

include <Arduino.h>

include <EEPROM.h>

void setup(void){
Serial.begin(115200);
EEPROM.begin(4096);
WiFi.mode(WIFI_AP_STA);
WiFi.softAP("ESP_LAN", "12345678");
WiFi.config(ip, gateway, subnet);
server.on("/", handleRoot);
server.on("/AppCMD",AppCMD);
server.on("/ServeMe", ServeMe);
server.onNotFound(handleNotFound);
server.begin();
Serial.println("HTTP server started");
WiFi.begin(ssid, password);
Serial.println(MONITOR_REQ_STR);
// Wait for connection
int k=0;
while (WiFi.status() != WL_CONNECTED && k<5) {
delay(500);
Serial.print(".");
k++;
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");

Serial.println(WiFi.localIP());

EEPROM.get(0,Tot_Recs);

if(Tot_Recs==0||Tot_Recs==255)
{
Serial.println("Init Started");
inIt();
}
else
{ Serial.println("Restarted");
ReStart();
}

}

void loop(void){
server.handleClient();
}

@indexpert indexpert changed the title Web server hosted on ESP8266 is not responding when home WIFI powered off. Web server hosted on ESP8266 is not responding when it is not connected to home wifi Mar 11, 2016
@igrr
Copy link
Member

igrr commented Mar 12, 2016

Duplicate of #1661

@igrr igrr closed this as completed Mar 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants