Date: Wed, 27 Sep 2000 11:02:02 -0500 From: Dan Nelson <dnelson@emsphone.com> To: Bjorn Tornqvist <bjorn@tornqvist.net> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: bind(2) gives EADDRINUSE during 60 seconds. Why? Message-ID: <20000927110202.A13235@dan.emsphone.com> In-Reply-To: <Pine.BSF.4.21.0009270957180.64865-100000@tornqvist.net>; from "Bjorn Tornqvist" on Wed Sep 27 09:58:13 GMT 2000 References: <Pine.BSF.4.21.0009270957180.64865-100000@tornqvist.net>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Sep 27), Bjorn Tornqvist said: > I hope someone can explain this behaviour to me; The kernel seems to > make a stream port "un-rebindable" within 60 seconds after another > stream-server-process has had the port bound. > The easiest way to illustrate (with port/sysutils/socket): > Terminal one: Terminal two: > socket -s 19191 > telnet localhost 19191 > ^C > Connection closed by foreign host > socket -s 19191 > socket: server socket: Address already in use > > [wait 60 seconds] > ...and socket -s 19191 will succeed again. > > What is causing this? This behaviour causes my application to fail a > critical requirement and there must surely be something wrong with my > (aswell as socket(1)'s) interaction with the tcp/ip stack? You forgot to "i=1; setsockopt(s,SO_REUSEADDR,&i);". Please read the Unix Socket FAQ at http://www.lcg.org/sock-faq/ ; sections 2, 3 and 4. -- Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000927110202.A13235>