Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept frequently fails with [Errno 107] ENOTCONN #7

Open
harbaum opened this issue Mar 28, 2022 · 10 comments
Open

Accept frequently fails with [Errno 107] ENOTCONN #7

harbaum opened this issue Mar 28, 2022 · 10 comments

Comments

@harbaum
Copy link

harbaum commented Mar 28, 2022

I am running the v1.0.4 firmware.uf2 release with the HTTP_Server example from examples/HTTP/HTTP_Server/HTTP_Server.py

I use a Raspberry Pico connected to one of these small blue w5500 boards (https://www.az-delivery.de/products/w5500-ethernet-netzwerk-internet-modul-fuer-arduino). The W5500 reads WIZnet W5500 DQK581 2133 which seems to be quite new.

The whole setup is rather unreliable and see errors like this one:

Connect from ('192.168.1.1', 80)
HTTP_Server.py, line 55, in main
OSError: [Errno 107] ENOTCONN

This is in "accept". Sometimes also the recv or the send fail.

This doesn't always happens. Most of the time the reply is sent just fine. But occasionally errors like these happen. They happen more often the more traffic there is on the connection. On a dedicated direct connection to a PC this works better, on a network shared with many other devices it becomes quite unreliable.

Hitting the reload button on the clients browser fast breaks the connection pretty fast usually in one of the send commands:

Connect from ('192.168.1.1', 80)
HTTP_Server.py, line 70, in main
OSError: 7

I tried adding a bunch of try/except to recover. But that needs a few seconds to recover and isn't a satisfying solution.

What is the reason for these errors? How can I fix them?

@irinakim12
Copy link
Contributor

I think you need to change your IP address. 192.168.1.1 can also be the IP address used as the gateway address of the router on the network.

Please use the IP address of W5500 by selecting a non-conflicting IP from values between 192.168.1.2 and 192.168.1.253.

@harbaum
Copy link
Author

harbaum commented Mar 29, 2022

This IP address is used in the P2P setup with 192.168.1.1 and 192.168.1.20 being the only machines on the cable.

In case of the bigger setup I configure this to use DHCP using nic.active instead of nic.ifconfig. But that doesn't affect the problem.

Both setups basically work but both frequently run into the NOCONN errors.

@harbaum
Copy link
Author

harbaum commented Apr 1, 2022

To verify: If you run the HTTP_Server.py on a PICO + W5500 running 1.0.4 you can repeatedly and fast click the on/off buttons in the browser without triggering any python exceptions due to failing accept/recv/send ?

@StefanKranz22
Copy link

I have the same Issue with a fresh new Pico Hat from Wiznet. In my Case the 1 Connection works. Then i get the same error.

@harbaum
Copy link
Author

harbaum commented Apr 11, 2022

I have yet to try e.g. the regular c/c++ version. Is this a Micro-Python only issue? Or does the same happen in other setups as well?

@StefanKranz22
Copy link

Yes, @harbaum i have test it with Micropython.

@StefanKranz22
Copy link

The same Code works well on a ESP 32.

@harbaum
Copy link
Author

harbaum commented Apr 18, 2022

Yes, @harbaum i have test it with Micropython.

The question was if that also happens in the c/c++ variant. So is this a Micro-Python specific problem or does this also happen in a different environment?

But since this renders the setup basically unusable I'd assume that the c/c++ setups don't exhibit this.

@harbaum
Copy link
Author

harbaum commented Jun 30, 2022

Is anyone having success with the released binaries and a W5500 running e.g. the Webserver demo reliably?

@UncleBee1885
Copy link

Is anyone having success with the released binaries and a W5500 running e.g. the Webserver demo reliably?

Yes. I have used them throughout the course of a project I'm working on to verify that the hardware is still functioning as normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants