delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/10/05/11:06:51

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <4162B878.9010801@etr-usa.com>
Date: Tue, 05 Oct 2004 09:06:32 -0600
From: Warren Young <warren AT etr-usa DOT com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.3) Gecko/20040910
MIME-Version: 1.0
To: Cygwin-L <cygwin AT cygwin DOT com>
Subject: Re: setsockopt SO_REUSEADDR
References: <NUTMEGcvJY4WocwAQq10000027b AT NUTMEG DOT CAM DOT ARTIMI DOT COM>
In-Reply-To: <NUTMEGcvJY4WocwAQq10000027b@NUTMEG.CAM.ARTIMI.COM>
X-IsSubscribed: yes

Dave Korn wrote:

>   Because SO_REUSEADDR works _correctly_ on cygwin, perhaps?

Oh, I don't know about that.

As I see it, the purpose of SO_REUSEADDR is to allow a program to bind 
to a port that still has WAIT states on it.  (FIN_WAIT_x, TIME_WAIT, 
etc...see netstat(1) and the Stevens TCP/IP books.)  The stack normally 
disallows this because packets may still be "in flight" that might be 
misdelivered if a program re-binds to this port before the wait states 
expire.  A program setting this flag is saying to the stack, "yes, I'm 
willing to take the risk to avoid waiting".  Setting this flag is 
important on some systems, such as Unixware, where some states can take 
10 minutes or so to expire.

This is quite different from allowing two active listeners on a single 
port.  I can't see a good reason for this.  Which program accepts the 
connection?

In any case, this behavior is all handled by the things behind the 
Winsock API, not by Cygwin.  I suspect that the Cygwin API is very thin 
at this point, just passing calls straight through to Winsock.  This 
difference of interpretation of the BSD sockets API is not Cygwin's problem.

--
Warren Young, maintainer of the Winsock Programmer's FAQ
http://tangentsoft.net/wskfaq/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019