LWN.net Logo

Cure worse than disease?

Cure worse than disease?

Posted Feb 17, 2007 6:42 UTC (Sat) by ldo (subscriber, #40946)
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.


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds