Comments (10)
Hello sandeepmistry,
I have tested and I think either there is an issue with available() method of server or I am not getting it, when you call available method from server and a new connection arrives, the method returns the following
return WiFiClient(((flag & SOCKET_BUFFER_FLAG_SPAWN_SOCKET_MSK) >> SOCKET_BUFFER_FLAG_SPAWN_SOCKET_POS), _socket + 1);
on WiFiServer.cpp
then, I have debugged the issue, since the second connection is getting the right socket number, but reference is lost in _client array of WiFiServer class, in WiFiClient constructor a new WiFi client is added to WiFi array of pointer by doing
WiFi._client[_socket] = this;
on WiFiClient::WiFiClient(uint8_t sock, uint8_t parentsock) method from WiFiClient.cpp
But then no memory is reserve so when available returns there pointer just get lost.
I understand the _client array of pointers should be used for holding client instances of connections but it seems there is some lack for this management in library.
I try to call available with new WiFiClient(server.available()), but same situation.
I finally get it working by returning new WiFiClass in available function of server,that is
return new WiFiClient(((flag & SOCKET_BUFFER_FLAG_SPAWN_SOCKET_MSK) >> SOCKET_BUFFER_FLAG_SPAWN_SOCKET_POS), _socket + 1);
This way you need to delete memory in you code, don't know if necessary but I am also doing
if (WiFi._client[_socket] == this){
M2M_INFO("remove socket %d from WiFi _client pointer list", _socket);
WiFi._client[_socket] = 0;
}
since you assign but then when you delete memory, there is a undefined reference in client array of server.
Please let me know your thoughts,
from wifi101.
Hi @mhanuel26,
I've submitted #77 to try to resolve this. If you get a chance please try it, you can download it from the following link and replace <sketch book>/libraries/WiFi101
with it.
https://github.com/sandeepmistry/WiFi101/archive/socket-buffer.zip
from wifi101.
Hi sandeepmistry,
I will try to integrate your changes asap and test if there are no more issues. Will let you know if there is a problem. By the way I open I ticket at Atmel because of #70 but never got response from them, perhaps the Microchip switch has take over... but I am seeing you did some changes to socket low level library too that might fix it.
Thank you
from wifi101.
Hi @mhanuel26,
Thank you for trying out the changes.
Could you please share your ticket number for #70 in a comment in that issue. I can open another support ticket to follow up on it.
from wifi101.
Hi sandeepmistry,
Yes I will test everything, just please wait for my feedback, I need to carefully replace your changes since I already did some changes as a workaround here. My workaround was working but I have an issue when serving a jQuery web page with other files like .css, it seems the browser open several sockets or do something that freeze the board even if I have been careful to allow access to SD card. Will try to confirm with your changes where is the problem and let you know, just give me sometime.
Thank you,
from wifi101.
Hi @mhanuel26, have you had a chance to test out the changes yet?
from wifi101.
Hi sandeepmistry,
Haven't been busy with other stuff last two weeks, I will do my best to test it asap.
Sorry for the delay.
from wifi101.
Hi @mhanuel26, any updates on this?
from wifi101.
I'm going to close this for now, I think it's a duplicate of #36.
Whenever you get a chance, please try out PR #77 and provide your feedback.
from wifi101.
Has anyone got multiple clients to connect? if so how?
i have a WINC1500 wifi module connected to my Teensy 3.2 and using the libraries at https://github.com/arduino-libraries/WiFi101, and I tried this lib https://github.com/sandeepmistry/WiFi101/archive/socket-buffer.zip
After adding the line in setup(), WiFi.setPins(8, 7, 4, 2); code runs and I can connect my Android phone to this web server and point my phones Chrome browser to 196.168.1.1 and the web page generated by the server displays correctly.
However I'm trying to connect a second phone to the web server, and the phone fails to make the connection.
Anyone get this to work?
from wifi101.
Related Issues (20)
- bitwise and operator used on sequential enum values HOT 3
- Green LED does not light when connecting using static IP on board rev b
- Compiler warning about buffer overflow in firmwareVersion() HOT 1
- 'if' statement at WifiClient.cpp:149 is useless HOT 1
- Wifi101 doesn't work once add the freeRTOS library HOT 3
- AP mode with WPA
- Modernize CI system
- HTTPS to sites using LetsEncrypt certificates with MKR1000 fails HOT 1
- Progressively slower transmission and potential buffer handling issue. HOT 5
- AP SSID goes back to default wifi101-xxxx after re-entering provision mode
- Add GitHub Actions workflow to synchronise with shared repository labels
- WiFi.ping(ip) freezes mkr1000 if WiFiUdp.h included
- Infinite stall on WiFiWebServer sample / MKR 1000 HOT 1
- WiFiServer simple improvements
- WiFi.hostname("MKR1000") function has no effects
- Multiple compilation problems on ESP8266 HOT 4
- Library does not work with WINC1500 and Mega2560 HOT 9
- Adafruit Feather M0 WiFi with uFL - ATSAMD21 + ATWINC1500 - fw 19.4.4
- Tx Power Mode
- Turn on WiFi hardware once turned off with WiFi.end()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wifi101.