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

Fast writing into a socket causes hang #273

Open
leoshusar opened this issue Aug 31, 2024 · 0 comments
Open

Fast writing into a socket causes hang #273

leoshusar opened this issue Aug 31, 2024 · 0 comments
Labels
type: imperfection Perceived defect in any part of project

Comments

@leoshusar
Copy link

leoshusar commented Aug 31, 2024

I'm using this library in PlatformIO on STM32F401 with both W5100 and W5500. In my application I'm using HTTP server and WebSocket server - that's where I've discovered this issue. When I have WS connected and I'm sending some HTTP requests, it randomly gets stuck in this loop, just stays there forever. SnIR returns 0 and SnSR returns 0x14.

image

I've managed to replicate the issue with just this piece of code:

#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

EthernetServer server{23};

void setup() {
  Ethernet.init(PB6);
  Ethernet.begin(mac);

  server.begin();
}

void loop() {
  auto client = server.accept();

  while (true) {
    if (client) {
      client.write("xxx");
      client.write("xxx");
    } else {
      break;
    }
    delay(10);
  }
}

This fails 100% of the time, just quicker than my main app, like in 1-10 seconds.

My observations:

  • when I keep only one client.write("xxx");, it looks like it works just fine (I waited for just like 20 minutes, not too long)
  • when I connected two clients and was alternating the writing between them, it also looked stable

I don't know if I'm just doing something wrong or if this is a bug in this library / in STM SPI / in Wiznet / ...

Any ideas please?
Thanks!

@per1234 per1234 added the type: imperfection Perceived defect in any part of project label Aug 31, 2024
@per1234 per1234 changed the title Fast writing into a socket issue - STM32 + Wiznet Fast writing into a socket causes hang Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants