-
Notifications
You must be signed in to change notification settings - Fork 106
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
Versions 1.4.0 and later break code that uses more than one WiFiServer and socket #87
Comments
hi @ocrdu can i ask for shortest sketch to reproduce your issue? the one you share is quite too long ad complex |
Hi Rocketct, I stripped out code; 138 lines now. Uses https://github.com/ocrdu/NINA-Websocket for the websocket functionality. The problem is still present in WiFiNINA 1.6; websocket communications on port 8080 will also trigger the webserver on port 80, as can be seen on the serial monitor. Changing WiFiClient WiFiServer::available(byte* status) in WiFiServer.cpp back to how it was in WiFiNINA 1.3 (the bit having to do with _lastSock) solves this. Here it is:
|
I have the same problem. I open one SSL connection successfully, but when I attempt to open a second one at the same time, both of my connections crash and sometimes the wifi module in the Arduino Uno Wi-Fi Rev.2 resets |
If it is the same problem, it should go away when you use https://github.com/ocrdu/WiFiNINA instead of the "official" one. Let us know! |
Apply [Oscar den Uijl](https://github.com/ocrdu) fix for MultiServers issue // See Version 1.4.0 can break code that uses more than one WiFiServer and socket // (arduino-libraries/WiFiNINA#87 #define USING_MULTI_SERVER_ISSUE_FIX true
Apply [Oscar den Uijl](https://github.com/ocrdu) fix for MultiServers issue // See Version 1.4.0 can break code that uses more than one WiFiServer and socket // (arduino-libraries/WiFiNINA#87 #define USING_MULTI_SERVER_ISSUE_FIX true
Sorry for the late response, I just had time to look at this again. My issue is very similar but is concerned with connecting with SSL using the WiFiSSLClient, so your fixes are not applicable. The code for the connectSSL method actually has the same problem; it doesn't keep the last used socket. I did some changes very similar to yours, but it seems like I can only have 1 active SSL connection at the same time, because it doesn't connect using a different socket number. Therefore I believe it is a limitation of the NINA-W102 chip |
Also, it seems like ServerDrv::getSocket() always returns 4. Do you happen to know what socket numbers are possible or how many different sockets are supported? |
The change in WebSocketServer.cpp involving _lastSock ("check previous received client socket for data before querying a new one") broke one of my sketches that uses two WiFiServer-s and two sockets, one for a web server on port 80 and the other for a websocket server on port 8080.
Setting up the websocket works fine, but once the webserver on port 80 has processed a request, data from the websocket client (web browser) starts ending up on port 80 (the previously used socket) and not on port 8080 (where the websocket server is).
I'm not sure, but could it be that the change involving _lastSock needs a check to see if the endpoints (IP/port) of sock and lastsock are the same? It seems it is cross-connecting two different sockets now.
Anyway, the sketch below works fine with 1.3.0, but not with 1.4.0 or later:
The text was updated successfully, but these errors were encountered: