[En-Nut-Discussion] Is this a bug or a 'Feature' ?

Harald Kipp harald.kipp at egnite.de
Thu Apr 3 09:57:52 CEST 2003


With TCP, sockets are not immediately destroyed. Instead they
enter the so called TIMEWAIT state. It is recommended to keep
the socket in this state for about 4 minutes. Ethernut delays
the socket release for about 20 to 30 seconds.

You can watch this behaviour in the socket list of the httpd
sample, while clicking on the update button of your browser

As far as I understood the mechanism, this is done to keep
the socket alive for segments, which may arrive after the
socket has been closed.

Almost every system will run out of memory (or socket buffers)
sooner or later, if you open and close TCP connections very fast.
The Ethernut http sample delays the execution as soon as memory
becomes low, to avoid this situation.


More information about the En-Nut-Discussion mailing list