Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

EthernetClient connect does not read data after a previous client is closed (but it can write) #9

Open
davehummel opened this issue Jan 1, 2021 · 1 comment

Comments

@davehummel
Copy link

davehummel commented Jan 1, 2021

In a scenario where I am handling a reconnect after the server restarts, I am starting a new client as follows:

EthernetClient client = EthernetClient();

client.connect(ip, port);

FDOS_LOG.printf("Ethernet client connect:%d\n", client.connected());

While this works perfectly the first time, the second time this client will never have bytes available() for reading. It does write properly (the remote server sees the data). Similar code works fine with the WifiClient (esp32 implementation).

Before creating the new client, I am calling .stop on the previous one.

@Stefar77
Copy link

Stefar77 commented Aug 8, 2021

Had the same issue.. (but using the older version buildin platformio teensy)
in NativeEthernetClient.cpp EthernetClient::available() the error handler always gets called even if there is no error.
You need to move the error_handler = fnet_error_get() part under/in the if(ret == -1){ container to fix this.

I don't need TLS for my project so not using the latest version myself however the latest version here on github should not have this problem so make sure you include the correct one and it should receive after you reconnect.

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

No branches or pull requests

2 participants