- Notifications
You must be signed in to change notification settings - Fork13.3k
ArduinoWiFiServer with send-to-all-clients functionality#7612
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
earlephilhower commentedSep 26, 2020
I think this is pretty cool,@JAndrassy! I would be careful about how |
JAndrassy commentedSep 26, 2020
Thank you@earlephilhower . I am not sure if it is useful, but at least it shows the difference between Servers in Arduino libraries and in ESP libraries. I attempted to test the SSL server, but telnet-ssl could not connected. I will test it again if this PR should be merged. |
JAndrassy commentedSep 27, 2020
@earlephilhower, multiple copies of BearSSL::WiFiClientSecure for one connection are not in sync. so ArduinoWiFiServer doesn't work because the copy it holds still returns available() based on _recvapp_len, even if the copy returned before already read the data from the connection. if the data is read again esp8266 crashes. axTLS works (the copies share the context object) |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
d-a-v commentedSep 29, 2020
From what I understand, there's only one copy for each client, given by |
JAndrassy commentedSep 29, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
the concept of Arduino Client is that multiple copies of WiFiClient/EthernetClient (created as return values or parameters passed by copy) can interact with the same TCP connection. WiFiClient should be only a pointer to internal representation. In ESP8266WiFi library the WiFiClient does it with ClientContext. the axTLS does it very very nice with the std shared pointer to SSLContext. (I think this strange concept of Arduino API classes has origin in simulating Java objects behaviour for some sketch source compatibility with Processing framework. so no In the ArduinoWiFiServer template the array of 'monitored' WiFiClient objects has instance pointing to the connection and server.available() returns a copy always when data are available for it. So the WiFiClient object in the array |
Uh oh!
There was an error while loading.Please reload this page.
d-a-v commentedSep 29, 2020
Right, I think we agree, I was meaning: "From what I understand, there's only oneTCP instance for each client, given by ::accept().". However maybe you should call on every occasion and even if it's useless |
JAndrassy commentedSep 29, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
for BearSSL the problem are the two copies of WiFiClientSecure for the same connection. one in the array of monitored clients and second in sketch filled at return from server.available(). the sketch reads data over its copy. the buffer counter _recvapp_len gets to 0. but the instance in the array still has the original value of _recvapp_len and returns the client again as if it has data available. available() calls bool() for every monitored client and bool() calls connected. |
d-a-v commentedOct 5, 2020
That is true. I wasn't aware. |
d-a-v commentedOct 28, 2020
Can you try with#7680 ? |
JAndrassy commentedNov 3, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
and second client gets for the second client "BSSL:_connectSSLServerRSA: OOM error" is logged |
d-a-v commentedNov 6, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thanks to@earlephilhower 's suggestion in gitter patched example: |
d-a-v left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
and with available() working according to Arduino documentationplus PagerServer example
and with available() working according to Arduino documentation. plus PagerServer example.
should the ESP8266WiFi library have this?