Wemos Lolin32 telnet abnormal delay

Rrobinet
Posts: 29
Joined: Wed Aug 16, 2017 7:05 am

Wemos Lolin32 telnet abnormal delay

Postby Rrobinet » Sat Aug 19, 2017 8:39 am

Hi,

Continuing to port my Wemos D1 program to Wemos Lolin32, I have a new issue:
To configure my Wemos Wifi I start this one as AP and connect to it via Telnet in order to configure the final Wifi Client credential.
This works perfect with Wemos D1, however the same configuration with LOLIN results is a deadlock of 30 sec before it reacts to the Telnet session.
See below the simplest program I could made to highlight the issue.
Wemos starts as an Access Point with SSID HA_COOR (default IP address 192.168.4.1, passpharse coordinator)
I use my PC to connect the AP HA_COOR with the appropriate credential (and wait until connected).
Then I start a Telnet session to 192.168.4.1, (which is instantaneous acknowledged by a Wemos D1), however with the ESP32 version this takes systematically 30 sec before acknowledgement.
I did use the statement haServer.setNoDelay(true); , but this has no influence.
Can someone explain me this phenomenon or indicate me the new sequence I should use for a LOLIN32
Thanks in advance
Robert

Code: Select all

#include <WiFi.h>            // ESP32 WiFi library
/* Default configuration while WiFi Coordinator Station is not set-up */
const char* ssid = "HA_COOR";                 // Default SSID in AP mode
const char* password = "coordinator";         // Default passphrase in AP mode
static WiFiClient haClient;
static IPAddress myLocalIp   (192,168,4,1);   // Coordinator IP address AP mode 
static IPAddress myGatewayIp (0,0,0,0);       // Server default IP router's gateway address:
static IPAddress mySubnet    (255,255,255,0); // Server subnet mask
WiFiServer haServer(23);                      // Temporary Server definition while getting the WIFI credentials
void setup()
{
  Serial.begin(115200);
   WiFi.mode(WIFI_AP);             // Ensure WiFi module is defined as Access Point
   WiFi.softAPConfig(myLocalIp, myGatewayIp, mySubnet); // Configure the AP with the default IP parameters
   WiFi.softAP(ssid,password);     // Configure the AP with the default credentials
   haServer.begin();               // Start the Telnet server
   haServer.setNoDelay(true);      // ?????
   Serial.println ("\nEntering in Access Point mode for credential configuration, wait for connection...");
}
void loop ()
{
  if (haServer.hasClient()) 
  {
     haClient = haServer.available();
     if (haClient.connected())    
     {
       Serial.print ("Connected to: "); Serial.println (haClient.remoteIP());
     }
  }
  haClient.print("Enter Home AP SSID (max 32 char.): ");// Send the SSID message to the Client
  delay (1000);
}
Last edited by Rrobinet on Mon Aug 21, 2017 6:49 am, edited 3 times in total.

Rrobinet
Posts: 29
Joined: Wed Aug 16, 2017 7:05 am

Re: Wemos Lolin32 telnet abnormal delay

Postby Rrobinet » Sat Aug 19, 2017 9:45 am

Hi,
I have more information looking at the Wifi traces.
I looks that with the LOLIN configuration my PC (IMac) starts a long DNS series of queries which is not the case with the Wemos D1 which consumes lot of times, then after a while the Telnet session may start.
Of course there is no DNS available so the only difference that I can see is that the D1 is faster to respond destination unreachable than the LOLIN one, so my MAC continues to send DNS requests which is flooding the WEMOS.
Please see attached Wemos D1 and LOLIN WireShark captures (filter on IP==192.168.4.1).
Robert
Attachments
Wemos D1&LOLIN captures.zip
Wemos D1 & LOLIN wireshark wireless traces
(65.9 KiB) Downloaded 604 times
Last edited by Rrobinet on Mon Aug 21, 2017 6:49 am, edited 1 time in total.

User avatar
martinayotte
Posts: 141
Joined: Fri Nov 13, 2015 4:27 pm

Re: Wemos Lolin32 telenet abnormal delay

Postby martinayotte » Sat Aug 19, 2017 6:00 pm

Did yu tried to leave a wired connection to your normal network, so that DNS won't flood ESP but normal network ?

Rrobinet
Posts: 29
Joined: Wed Aug 16, 2017 7:05 am

Re: Wemos Lolin32 telnet abnormal delay

Postby Rrobinet » Sun Aug 20, 2017 8:21 am

Yes,
In both cases my Ethernet connexion is present.
I have also tried to deactivated the Ethernet connexion and in this case the response time with the Wemos D1 is also long
Now I have a fixed configuration for the DNS servers, but even by removing them nothing changes.
Finally I believe the phenomenon is more related to the behaviour of my MAC regarding DNS queries than to the Wemos one.
Note that in both cases, the DNS IP address received burring the DHCP exchange is the one of the Wemos (default one)

Anyhow its is working I just have to wait +/-30sec :)
I will continue with my migration to WEMOS LOLIN, I hope not to have too may surprises.
Thanks for the feedback
Robert

User avatar
martinayotte
Posts: 141
Joined: Fri Nov 13, 2015 4:27 pm

Re: Wemos Lolin32 telnet abnormal delay

Postby martinayotte » Sun Aug 20, 2017 3:07 pm

Rrobinet wrote: Now I have a fixed configuration for the DNS servers, but even by removing them nothing changes.
I would rather do the reverse by adding an external DNS, such as 8.8.8.8 before any others.
The best would be to figure out which Mac application is doing such DNS flooding, and kill/disable this application if possible.

Rrobinet
Posts: 29
Joined: Wed Aug 16, 2017 7:05 am

Re: Wemos Lolin32 telnet abnormal delay

Postby Rrobinet » Mon Aug 21, 2017 6:47 am

Martin,
Adding the Goggle DNS server will not help for this particular issue (but is probably in general a good and stable one).
Regarding the simultaneous Ethernet and WiFi configuration, I believe that WiFi has higher priority than Ethernet, also the IP address of the Ethernet interface is in another subnet than the WEMOS one, so my MAC will not try to resolve DNS name from the Ethernet interface even if this one is active.
Now I had a deeper look at the traces I have made, and most of the DNS queries are related to my e-mail configuration which is a little bit complex (trying to access Hotmail, Gmail, Yahoo mail,....).
The problem is definitively not an ESP one I have tried with another Window PC and the access via telnet is nearly immediate.

I also must say that the usage I make of the AP configuration is special, its a one shot access used to give the flexibility from a newly programmed device to receive the actual WiFi configuration (typically SSID and Credential), so probably few will be confronted to the same issue.

However I conclude that the WEMOS LOLIN is slower than the WEMOS D1 to reply with an ICMP Destination unreachable on DNS query

Anyway thanks for the exchange of ideas helping me to troubleshoot this issue.
Robert

Who is online

Users browsing this forum: Bing [Bot] and 83 guests