Comments (16)
@drp0 what board(s) are you testing with?
On the MKR1000, using the SimpleWebServerWiFi.ino example sketch and using nc <IP address> 80
from a Mac. I can only establish 2 connections at a time, on the 2rd attempt Wireshark shows the connection being accepted, immediately followed by a disconnect.
from wifi101.
With the current ASF base, there is essentially a backlog of one pending connection until server.available()
is called again. Any incoming connections will be accepted by the firmware, then immediately will be disconnected by the ASF code, see this block of code: https://github.com/arduino-libraries/WiFi101/blob/master/src/socket/source/socket_buffer.c#L216-L219
@ThibaultRichard any thoughts on how this can be improved?
from wifi101.
Hello Sandeep,
I am working with the Arduino mega 2560.
The wifi101 firmware is 19.4.4.
The library is version 0.8.0
Your experience on the Mac is like mine.
Could this use of a maximum of (up to) 2 sockets, also be the cause of the ftp download failure in #32?
The maximum number of tcp sockets in the library is more than two.
Cheers,
David
From: Sandeep Mistry [mailto:[email protected]]
Sent: 02 March 2016 20:58
To: arduino-libraries/WiFi101
Cc: drp0
Subject: Re: [WiFi101] Server uploads two images on a html page, the rest are not processed (#36)
@drp0 https://github.com/drp0 what board(s) are you testing with?
On the MKR1000, using the SimpleWebServerWiFi.ino https://github.com/arduino-libraries/WiFi101/blob/master/examples/SimpleWebServerWiFi/SimpleWebServerWiFi.ino example sketch and using nc 80 from a Mac. I can only establish 2 connections at a time, on the 2rd attempt Wireshark shows the connection being accepted, immediately followed by a disconnect.
—
Reply to this email directly or view it on GitHub #36 (comment) . https://github.com/notifications/beacon/ANHAGrOdyCNyVIq8hDDBsisFVBzndg5rks5ppfnQgaJpZM4Hi_CH.gif
from wifi101.
@drp0 thanks for the info. The behaviour in this issue is specifically related to TCP server sockets, so unrelated to #32.
from wifi101.
What is the socket limit on the Amtel chip?
I have a memory of reading somewhere in the arduino library that the maximum number of tcp sockets was 7, although I can-not recall which file contained the information.
I had a quick look at the code snippit [https://github.com/arduino-libraries/WiFi101/blob/master/src/socket/source/socket_buffer.c#L216-L219]
I am surprised it did not do a test of the number of sockets open, against the maximum number of sockets. Could this lead to a workround?
I have just tried commenting out line 218: close(pstrAccept->sock); in socket_buffer.c
The server will then upload all the images on a sample page of 4 pictures.
The arduino software issues a client.stop() correctly.
The library software does not appear to process the instruction and the client browser waits with a receiving data message. (I was not surprised)
If the browser cancel download "X" is selected, the server will supply the next request.
David
from wifi101.
What is the socket limit on the Amtel chip?
Correct it's 7, see socket.h.
I am surprised it did not do a test of the number of sockets open, against the maximum number of sockets. Could this lead to a workaround?
Agreed there should be a check.
Only work around I can think of is to have your sketch call server.avaible()
more frequently for now.
from wifi101.
Hi @drp0, if you are still interested in this, could you please try PR #204 when you get a chance. Thanks.
from wifi101.
from wifi101.
Hi @drp0,
You can:
- Backup your
<sketchbook>/libraries/WiFi101
folder - Download https://github.com/sandeepmistry/WiFi101/archive/socket-buffer-winc1500.zip
- Extract zip
- Place zip from library in
<sketchbook>/libraries/WiFi101
- Restart the IDE and try it out
To restore, delete the <sketchbook>/libraries/WiFi101
folder and replace with the one backed up in step 1).
from wifi101.
from wifi101.
Hi @drp0,
Thanks for trying and apologies for not being clear on what I wanted you to test.
I include <TimeLib.h> as that worked in previous incarnations of yifi101
I seem to recall a lot of discussion on your choice of library for time support.
I get the warning “No system <time.h> header included, WiFi.getTime() wil always return 0”
So what have you changed and what are the implications for anything written in previous versions of >YIFI101?
No changes have been made for this.
The remote IP and port callback routine you gave me no longer works:
I've renamed socketBufferCb
to socket_cb
.
I hope you can maintain an option to get the remote IP for security reasons
It's easier to make have a public API for this once the PR is merged.
- I can now get 4 pictures back from yifi101 on one page- obviously a great improvement- further testing tomorrow
I have not yet tried to time the page serving rate- but it appears to be faster.
Ok, that's great news. The changes in the pull request allow the WiFi101 to have more than one accepted socket pending from a server. Previously as the issue is titled after one pending accepted connection, the WiFi101 library would close the socket.
from wifi101.
Hi Sandeep,
Good news indeed.
If the socket limit is 7, what would happen if a page contained more than 7 servable objects?
I tried altering line 10 above to
socket_cb(sock, u8Msg, pvMsg);
and got
socket_cb was not declared in this scope
Is there a temporary work round?
David
from wifi101.
If the socket limit is 7, what would happen if a page contained more than 7 servable objects?
So one socket will be taken up by WiFiServer
, so that leaves 6 left for incoming connections. You'll have to carefully manage WiFiClient
's and check if there is pending socket data if you are using an AVR based board.
Is there a temporary work round?
In src/WiFi.cpp
there the following line:
static void socket_cb(SOCKET sock, uint8 u8Msg, void *pvMsg)
remove the static
so it becomes:
void socket_cb(SOCKET sock, uint8 u8Msg, void *pvMsg)
then in your sketch add void socket_cb(SOCKET sock, uint8 u8Msg, void *pvMsg);
to forward declare it.
from wifi101.
That all works
So far the server appears more stable than before.
Thanks,
David
from wifi101.
Great, thanks for testing and the feedback :)
from wifi101.
Now that PR #204 is merged, this is fixed.
from wifi101.
Related Issues (20)
- 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()
- MKR1000 no connection with SSL (https) HOT 1
- ATWINC1500 with WiFi101 with MQTT always leads to a dead connection after some time HOT 2
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.