setsockopt SO_REUSEADDR

Brian Ford ford@vss.fsi.com
Tue Oct 5 14:52:00 GMT 2004


On Tue, 5 Oct 2004, Dave Korn wrote:

> > -----Original Message-----
> > From: cygwin-owner On Behalf Of Rainer Hochreiter
> > Sent: 05 October 2004 15:29
>
> > running the program listed below with argument 'reuse' under
> > cygwin and linux returns different results!
> >
> > from my point of view, the linux result is quite what i
> > expected, a bind() error 'Address already in use'.
>
>   Huh?  But that's exactly what SO_REUSEADDR is supposed to _prevent_
> from happening.  That's why it's called _REUSE_addr, because it lets you
> *re-use* an addr, without getting an error message.  Why would you
> expect setting it to stop you from reusing the address?

I was about to say the same thing, but...

http://www.unixguide.net/network/socketfaq/4.5.shtml

It is only supposed to reuse if the other socket is in the TIME_WAIT
state.  I think that is what he is complaining about.

BTW to the OP, why are you printing the address of the socket function
out?  I think you meant to print "s" instead of "socket"?

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained pilot...

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



More information about the Cygwin mailing list