Socket accept and "Too many open files"

Did ever a socket accept() fail on you with the "Too many open files" error ? I know it happened for me so here's a short article about the things that helped me get rid of the problem.