Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Sep 2001 10:28:05 -0700 (PDT)
From:      Matt Dillon <dillon@earth.backplane.com>
To:        rick norman <rick.norman@lmco.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: bind : address already inuse
Message-ID:  <200109281728.f8SHS5E28842@earth.backplane.com>
References:   <3BB4AB67.61217AA4@lmco.com>

next in thread | previous in thread | raw e-mail | index | archive | help

:--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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200109281728.f8SHS5E28842>