Date: Sat, 15 Sep 2001 21:12:11 -0400 From: Dan Moschuk <dan@FreeBSD.ORG> To: Stephen Montgomery-Smith <stephen@math.missouri.edu> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Could not bind Message-ID: <20010915211211.A11699@spirit.jaded.net> In-Reply-To: <3BA3F70D.27C2136@math.missouri.edu>; from stephen@math.missouri.edu on Sat, Sep 15, 2001 at 07:49:17PM -0500 References: <3BA3F70D.27C2136@math.missouri.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
| I have written a server program that listens on port 3000. The program | works very well except for one feature. I am asking if that is normal, | or whether I forgot something. | | If I run the program it does fine. If I then kill the program (after it | has accepted connections), and then run the program again, the bind | function fails to work, and I get a message like "Could not bind" (see | program below). If I wait a while, like a minute or two, then the | program will work again. Is this normal behavior, or did I miss | something? [ snip ] This is normal behavior. bind() will fail if there are still sockets in the TIME_WAIT (and other) states. To get around this, you want to use set the SO_REUSEPORT option using setsockopt(). -Dan -- Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010915211211.A11699>