Date: Fri, 28 Sep 2001 19:56:34 +0200 From: Bernd Walter <ticso@mail.cicely.de> To: rick norman <rick.norman@lmco.com> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: bind : address already inuse Message-ID: <20010928195634.A12561@cicely20.cicely.de> In-Reply-To: <3BB4AB67.61217AA4@lmco.com>; from rick.norman@lmco.com on Fri, Sep 28, 2001 at 09:55:03AM -0700 References: <3BB4AB67.61217AA4@lmco.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Sep 28, 2001 at 09:55:03AM -0700, rick norman wrote: > When an app binds an address and port to a listen socket, what > variables > can I adjust so the address may be reused immediately after the app > exits. > My understanding was that > int on = 1; > setsockopt(s,SOL_SOCKET,SO_REUSEADDR,&on,sizeof(on)); > would do it but there still seems to be a significant amount of time > between > the exit and bind allowing a new app to use the address, even though > there > are no inbound connections pending in the listen queue when the exit > occurs. > I am debugging a server and the process requires restarting often. You need to do this before bind/listen and I asume you should fork between creating this socket and setsockopt. You might want to check if there is still a process listening - a child comes into mind - or if there are only existing state informations about old connects. SO_REUSEADDR protects you only for the later. netstat and sockstat are your friends. -- B.Walter COSMO-Project http://www.cosmo-project.de ticso@cicely.de Usergroup info@cosmo-project.de 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?20010928195634.A12561>