After a lot of debugging I found that the problem was TCPTV_MSL from tcp_timer.h. This is the maximum segment lifetime and the default value is 30 seconds. When a socket is closed it is not immediately returned to the pool of available sockets, the socket is returned after 2 * TCPTV_MSL time (60s). So it is really easy to run out of sockets if you refresh the browser several times or navigate quickly. The default implementation of the ecos http daemon is not usable in my opinion. Other people encountered similar problems (http://groups.google.de/group/clinet.list.freebsd-bugs/browse_thread/thread/8501571128148cd2/6a2ea5304bdc9cd1?lnk=st&q=tcptv_msl&rnum=10&hl=en#6a2ea5304bdc9cd1). So I think in a resource-limited system the TCPTV_MSL value should be reduced, e.g 3 seconds.
I wonder how other tcp/ip stacks handle this, especially those that target embedded systems.