Some kind of delay in ethClient.connected.

I’m using an Ethernet Shield W5100 here and i can already send data to where i want, flawless, so i went to do the reconnect, case in some moment Ethernet drops and reestablish right after.

I already saw the non-blocking example on git and come with something like…

EthernetClient client;

void loop()
{

if(client.connected())
{
//stuff done
}
else
{
reconnect()
}

}

It reconnects fine but one thing is bothering me.

Why the client.connected() method have a 25-30 second delay to discover my connection dropped ?
(I’m removing the cable off just to test)

What can i do to reduce this delay ?

Thanks in advance.

you can use Ethernet.linkStatus()

if (Ethernet.linkStatus() != LinkOFF)

connected() will be true until data to read are available in RX buffer