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

Client.Stop slow #53

Open
electroremy opened this issue Mar 1, 2021 · 0 comments
Open

Client.Stop slow #53

electroremy opened this issue Mar 1, 2021 · 0 comments

Comments

@electroremy
Copy link

Hi, I use the Ethernet lib featured by Arduino with the W5500 Arduino Official Ethernet Shield II

I notice that client.stop is slow... I found that Ethernet.socketStatus(sockindex) == SnSR::CLOSED never append.

So I change the function to do not wait until Ethernet.socketStatus(sockindex) == SnSR::CLOSED and it's works fine.

`void EthernetClient::stop() {
if (sockindex >= MAX_SOCK_NUM) return;
// attempt to close the connection gracefully (send a FIN to other side)
Ethernet.socketDisconnect(sockindex);

// Waiting for the connection to close is useless and VERY SLOW !
/*
// wait up to a second for the connection to close
unsigned long start = millis();
do {
	if (Ethernet.socketStatus(sockindex) == SnSR::CLOSED) {
		sockindex = MAX_SOCK_NUM;
		return; // exit the loop
	}
	delay(1); 
} while (millis() - start < _timeout); 
*/

delay(1); 

// if it hasn't closed, close it forcefully
Ethernet.socketClose(sockindex);
sockindex = MAX_SOCK_NUM;

}`

Also, I notice that there are several TODO in your library files (Ethernet, EthernetClient, EthernetServer, Socket, W5100...)

Does the Ethernet library is up to date on Arduino website ?

Bests regards.

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

1 participant