arduino / arduino/ArduinoCore-mbed

GIGAR1: conflict between Access Point and common WiFi connection

Open
#858 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
411
Forks
225
PR merge metrics
No merged PRs in 30d

Description

Hello,

I am facing some issues while trying, in a larger project, to accomplish the following:
1. Try to connect to the internet via WiFi
2. If connection fails, open Access Point (AP) and let user insert WiFi credentials (through captive portal)
3. Go back to point 1

Every time I close a connection, I call `WiFi.disconnect()` and `WiFi.end()`; Moreover, when AP operations are completed, I call `WiFiClient::stop()`. My `WiFiClient` object is global and obtained through `WiFiServer::available()`.

After closing AP connection, I could connect to the WiFi but any connection (e.g., to www.google.com) failed by a time-out. I kind of solved the problem through the following code I invoke every time I switch between point 1 and 2 of the algorithm.
`WiFi = WiFiClass(WiFiInterface::get_default_instance());`
However I do not understand such a behaviour.

Now, if WiFi connection fails after AP was accomplished once, AP is opened again, but this time `WiFiServer::available()` fails, in the sense that no data are ever available. However, I controlled network traffic through Wireshark and I see that DNS management through `WiFiUDP` succeded, while an http request `GET /wpad.dat HTTP/1.1` was sent by the client, but never received by the server.

It seems to me that there are library issues then, or at least poor documentation for me to be able to understand whether I am doing anything wrong

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the sequence of WiFi disconnect/end, access-point use, and reconnection described in the issue. Inspect WiFiServer::available(), WiFiUDP, WiFiClient::stop(), and the WiFiClass reset behavior while switching modes. Done means the cause of the failed HTTP request is identified and documented or reproduced with a focused fix and verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.