Cure worse than disease?
Posted Feb 17, 2007 6:42 UTC (Sat) by ldo
Parent article: Five Pitfalls of Linux Sockets Programming (developerWorks)
I'm not so sure that SO_REUSEADDR is a good idea. That TIME_WAIT state is there for a reason, and overriding it can lead to exactly the sort of situation it was designed to prevent.
My preferred solution, when I get an EADDRINUSE error when one of my server processes starts up, is to keep running anyway, and simply retry the bind every 60 seconds until it succeeds.
to post comments)