The issue with TCP timeout and teardown is a well known and documented one.
We have a very simple raw counter called #define CLIENT_MAX_INACTIVITY_RETRIES 100000
If you want to reduce the timeout - reduce that value and recompile your sketch.
EtherntClient.h : #define CLIENT_MAX_INACTIVITY_RETRIES 100000
thank you for your answer.
Unfortunately, it doesn't work for me. I have reduced CLIENT_MAX_INACTIVITY_RETRIES up to 1 and increased it up to 1000000, but I always get
a timeout of 5005 ms.
What am I missing ?
I have investigated more on this issue and I have found a solution:
1) Locate the available() function into the file EthernetClient.cpp in .../hardware/arduino/x86/libraries/Ethernet
2) change the value of timeout variable
3) recompile the sketch