Go Down

Topic: ScanNetworks seems to disconnect established TCP connections ? (Read 1 time) previous topic - next topic

Aybert

Hi there

I recently ported a well working project from Arduino Uno to the Arduino Uno Wifi. So far so good.
The Arduino connects well to my Wifi AP and establishes properly a TCP socket to my server. Data exchange performs well both ways.
Then in the suite of events I happen to perform a ScanNetworks; which terminates well (I can see the expected output on the serial line)
But then I cannot write anymore to the TCP socket, which seems disconnected.
Any clue ?
Thanks

Aybert

I manage to isolate the interesting part of the code (full project available on github - see link from my profile)


in setup :

WiFiClient WiClient;

...

WiFi.begin(ssid[CurrentAP].c_str(), pass[CurrentAP].c_str());
WiClient.connect (host, port);

// all is fine, i can read, write as necessary

...

ecran.print (WiClient.status()); // output shows 4
numSsid = WiFi.scanNetworks();
ecran.print (WiClient.status()); // output shows 0

I do not know where to find the return value meanings for the status method, but I bet 0 means something like disconnected. The fact that the status changes is itself not good sign...
Any WiClient.write I perform later returns 0.

Someone knows how to scan without disconnecting established connections ? I remember playing with an ESP8266 directly, I could switch from Data to Command mode back and forth without such issue...

Go Up