From owner-freebsd-hackers Fri Sep 28 10:28:10 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from earth.backplane.com (earth-nat-cw.backplane.com [208.161.114.67]) by hub.freebsd.org (Postfix) with ESMTP id 6544F37B40B for ; Fri, 28 Sep 2001 10:28:07 -0700 (PDT) Received: (from dillon@localhost) by earth.backplane.com (8.11.6/8.11.2) id f8SHS5E28842; Fri, 28 Sep 2001 10:28:05 -0700 (PDT) (envelope-from dillon) Date: Fri, 28 Sep 2001 10:28:05 -0700 (PDT) From: Matt Dillon Message-Id: <200109281728.f8SHS5E28842@earth.backplane.com> To: rick norman Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: bind : address already inuse References: <3BB4AB67.61217AA4@lmco.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG :--Boundary_(ID_mQ1p0DshiB00ke/hmU0cHA) :Content-type: text/plain; charset=us-ascii :Content-transfer-encoding: 7BIT : :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. : :Thanks, :Rick SO_REUSEADDR is the correct socket opt and it will allow the address to be reused immediately. If you still get 'address already in use' then there is still another process listening on the socket... probably an older named that you missed, or perhaps the other named simply wasn't exiting quickly enough before you started the new one. -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message