I've been trying to use the Arduino WiFi shield for building a web server, but I ran into the following issue, while debugging my code. It seems that the client connections are not properly handled by the WiFi library. When I open two tcp connections to the server at the same time, there is no way to know what data comes from which connection using the provided API. More precise, data comes in from both sessions as if they were coming from the same session and when I send data out through the WiFi shield, the session that was first open receives the data.
To reproduce this, I have set up the following scenario.
- Upload the WiFiWebServer example sketch to the board and open the serial console in order to see the debug messages.
- Using telnet (or another tool), connect to the Arduino on port 80 (SESSION1).
telnet xxx.xxx.xxx.xxx 80
- Open one more telnet session, on port 80 (SESSION2).
- In SESSION2, type an HTTP request (e.g. "GET / HTTP/1.1" without quotes; press ENTER twice to send an additional blank line, marking the end of the request).
The problem is that the server (Arduino) will send the response to SESSION1, even though the request is made in SESSION2. I suspect that there is a problem in the WiFi library, but I couldn't find it.
Has anyone else encountered this issue? Is there a workaround for this?
I've looked through the forums and there seem to be many issues with the WiFi shield.
Thanks a lot!