Replies: 2 comments 6 replies
-
i also noticed a second client request that does not show up in browser network activity in the async server example there is a inf loop as a result of that request i do not see why this script is hanging on the empty request the empty request caused me no issues when testing that example you are going by you could try
running this firmware: rp2-pico-w-20220923-unstable-v1.19.1-443-g30e50ab19 |
Beta Was this translation helpful? Give feedback.
-
I've discovered that it the behaviour is due to Chrome - Chrome is opening a second TCP connection, just in case it needs to use it, but not sending any data. It is described here https://stackoverflow.com/questions/47336535/why-does-chrome-open-a-connection-but-not-send-anything When using Firefox (possibly an older version) this issue does not occur. Unfortunately there is no obvious way to detect such an "empty" connection and perhaps close it. RECV in other implementations has a Peek option to see if there is any data, Micropython doesn't seem to support this. However, I suspect that it ought to Out of interest how does one make Microdot available on a Pico? I've found the github repository but how does one normally add something like this? (yes, I'm a proper newbie to this tech!) |
Beta Was this translation helpful? Give feedback.
-
I'm new to micropython and Pico but I've been coding professionally for 35 years so not wet behind the ears.
I've got a Pico W and using latest firmware from micropython site (rp2-pico-w-20221011-unstable-v1.19.1-532-g8e912a501)
When I run the attached standard sample code and you start the web server up it starts listening on a port. When a client connects the socket.accept returns an inbound socket. the socket.recv(1024) then pulls the data in. It sends something back to the client and then closed the socket.
Immediately another inbound connection is established (although this has not been requested by the client), a new socket is returned BUT there is no data and so the socket.recv(1024) just hangs. Eventually it times out and the request data is empty.
If another request is sent by the browser (by manually refreshing) before timeout then it appears to work correctly, but it isn't. It becomes especially obvious if you have two separate clients (different IP addresses) that are requesting data. One or other just hangs whilst the .recv continues to hang.
Can't believe something so simple is so broken! What am I doing wrong and what do I have to do to get round this?
main.txt
Beta Was this translation helpful? Give feedback.
All reactions