tzapu / WiFiManager

ESP8266 WiFi Connection manager with web captive portal
http://tzapu.com/esp8266-wifi-connection-manager-library-arduino-ide/
MIT License
6.57k stars 1.97k forks source link

esp32: Captive Portal does not work on windows 10 #926

Open amrlsayed opened 5 years ago

amrlsayed commented 5 years ago

Basic Infos

Hardware

ESP32 WROOM WiFimanager Branch/Release:

Esp8266/Esp32:

Hardware: ESP-12e, esp01, esp25

**ESP32 Core Version:

Description

I have a more complex project. but to make it simple I am testing only the "OnDemandConfigPortal" Example. It works Good on Android but not on Windows 10. I tried disabling the firewall without luck. when I connect to the AP from the PC I see this debug message more frequently

dhcps: send_offer>>udp_sendto result 0
dhcps: send_offer>>udp_sendto result 0

I think those are not errors because result 0 is the LWIP ERR_OK sometimes when i connect to the AP. it redirects me to msn.com but then when i type the IP (192.168.4.1) on the browser I get no response "ERR_CONNECTION_TIMEOUT" then the output in the serial terminal is

*WM: [3] -> www.msftconnecttest.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [3] -> www.msftconnecttest.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [3] -> wpad.mt.local 
*WM: [2] <- Request redirected to captive portal 
*WM: [2] <- HTTP Root 
*WM: [3] -> 192.168.4.1 

when I type ipconfig on windows cmd. I find that it gets an IP from the AP

Wireless LAN adapter Wi-Fi:
   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::1c0c:5a92:c42f:6a4e%3
   IPv4 Address. . . . . . . . . . . : 192.168.4.2
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.4.1

Settings in IDE

Module: ESP32 Dev Module

Additional libraries: no additional libraries

Sketch


/**
 * OnDemandConfigPortal.ino
 * example of running the configPortal AP manually, independantly from the captiveportal
 * trigger pin will start a configPortal AP for 120 seconds then turn it off.
 * 
 */
#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager

// select which pin will trigger the configuration portal when set to LOW
#define TRIGGER_PIN 0

int timeout = 120; // seconds to run for

void setup() {
  WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP  
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("\n Starting");
  pinMode(TRIGGER_PIN, INPUT_PULLUP);
}

void loop() {
  // is configuration portal requested?
  if ( digitalRead(TRIGGER_PIN) == LOW) {
    WiFiManager wm;    

    //reset settings - for testing
    //wifiManager.resetSettings();

    // set configportal timeout
    wm.setConfigPortalTimeout(timeout);

    if (!wm.startConfigPortal("OnDemandAP")) {
      Serial.println("failed to connect and hit timeout");
      delay(3000);
      //reset and try again, or maybe put it to deep sleep
      ESP.restart();
      delay(5000);
    }

    //if you get here you have connected to the WiFi
    Serial.println("connected...yeey :)");

  }

  // put your main code here, to run repeatedly:
}

Debug Messages

WM: [3] WIFI station disconnect 
*WM: [3] WiFi station enable 
*WM: [2] Disabling STA 
*WM: [2] Enabling AP 
*WM: [1] StartAP with SSID:  OnDemandAP
*WM: [2] AP has anonymous access! 
*WM: [1] AP IP address: 192.168.4.1
*WM: [3] setupConfigPortal 
*WM: [1] Starting Web Portal 
*WM: [3] dns server started with ip:  192.168.4.1
*WM: [2] HTTP server started 
*WM: [2] WiFi Scan ASYNC started 
*WM: [2] Config Portal Running, blocking, waiting for clients... 
dhcps: send_offer>>udp_sendto result 0
dhcps: send_offer>>udp_sendto result 0
*WM: [3] -> www.msftconnecttest.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [3] -> www.msftconnecttest.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [3] -> wpad.mt.local 
*WM: [2] <- Request redirected to captive portal 
*WM: [2] <- HTTP Root 
*WM: [3] -> 192.168.4.1 

Before opening this issue. I tested CaptivePortal Example from ESP32 Arduino SDK examples. it didn't work for windows but worked on Android. I though it might be related so I put a comment on this issue reporting the problem. I got the suggestion to open a new issue here though.

Thanks a lot

viperk1 commented 5 years ago

I'm running into the same issue. Hope this can be diagnosed!

tablatronix commented 5 years ago

check firewall

amrlsayed commented 5 years ago

Hi Shawn, I disabled the firewall but same problem. Do you mean it's working good with you on windows and the problem would be our environment such as Firewall ?

tablatronix commented 5 years ago

No, windows 10 firewall can block captive portals

connornishijima commented 4 years ago

It doesn't work on a Galaxy S8 running Android 9 (Pie)

iw2lsi commented 3 years ago

same problem here... on Windows 10 the captive portal is not opened... and the connection is not established; seems to works on iOS.

tablatronix commented 3 years ago

Try without firewall ?

iw2lsi commented 3 years ago

Hi,

yes... firewall was not enabled...

   Giampaolo

Il giorno gio 27 mag 2021 alle ore 17:16 Shawn A @.***> ha scritto:

Try without firewall ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tzapu/WiFiManager/issues/926#issuecomment-849720049, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAODQQCSPUU4VYVMXA2BWZTTPZO55ANCNFSM4IL7ZLHA .

tablatronix commented 3 years ago

It has been awhile since I last used windows 10, have you disabled other network connections ?

iw2lsi commented 3 years ago

Hi Shawn,

that's a good point... I have a wired network too... I'm checking it right now...

    Giampaolo

Il giorno gio 27 mag 2021 alle ore 17:42 Shawn A @.***> ha scritto:

It has been awhile since I last used windows 10, have you disabled other network connections ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tzapu/WiFiManager/issues/926#issuecomment-849738806, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAODQQEBDM7YWZSDNEGRHJDTPZR4ZANCNFSM4IL7ZLHA .

iw2lsi commented 3 years ago

Hi...

no... it does not work even with the wired card disabled... this is the log... could it just be a timeout problem ?

     Giampaolo

Starting WM: [3] allocating params bytes: 20 WM: [2] Added Parameter: WM: [1] AutoConnect WM: [1] No Credentials are Saved, skipping connect WM: [2] Starting Config Portal WM: [2] AccessPoint set password is VALID WM: [1] password WM: [3] WIFI station disconnect WM: [3] WiFi station enable WM: [2] Disabling STA[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 3 - STA_STOP [2] Enabling AP WM: [1] StartAP with SSID: AutoConnectAP [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 0 - WIFI_READY WM: [1] SoftAP Configuration WM: [1] -------------------- WM: [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 14 - AP_START WM: [1] password: password WM: [1] ssid_len: 13 WM: [1] channel: 1 WM: [1] authmode: WM: [1] ssid_hidden: WM: [1] max_connection: 4 *WM: [1] country: CN

WM: [1] beacon_interval: 100(ms) WM: [1] -------------------- WM: [1] AP IP address: 192.168.4.1 WM: [3] setupConfigPortal WM: [1] Starting Web Portal WM: [3] dns server started with ip: 192.168.4.1 WM: [2] HTTP server started [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 2 - STA_START [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 1 - SCAN_DONE WM: [2] WiFi Scan completed in 5304 ms WM: [2] Config Portal Running, blocking, waiting for clients... [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 16 - AP_STACONNECTED [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 18 - AP_STAIPASSIGNED WM: [2] Portal Timeout In 3 seconds WM: [1] config portal has timed out WM: [3] configportal abort WM: [2] disconnect configportal WM: [0] [ERROR] disconnect configportal - softAPdisconnect FAILED WM: [2] restoring usermode STA WM: [2] wifi status: WL_DISCONNECTED WM: [2] wifi mode: STA WM: [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 15 - AP_STOP [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 15 - AP_STOP

Il giorno gio 27 mag 2021 alle ore 17:46 Giampaolo Bellini @.***> ha scritto:

Hi Shawn,

that's a good point... I have a wired network too... I'm checking it right now...

    Giampaolo

Il giorno gio 27 mag 2021 alle ore 17:42 Shawn A @.***> ha scritto:

It has been awhile since I last used windows 10, have you disabled other network connections ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tzapu/WiFiManager/issues/926#issuecomment-849738806, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAODQQEBDM7YWZSDNEGRHJDTPZR4ZANCNFSM4IL7ZLHA .