dev@glassfish.java.net

Re: [FYI] More frequent BindException to occur

From: Bill Shannon <bill.shannon_at_sun.com>
Date: Mon, 25 Jan 2010 12:08:20 -0800

Does anyone know whether and how this issue was resolved?

Jeanfrancois Arcand wrote on 10/30/09 12:27 PM:
>
>
> Le 2009-10-30 à 14:39, Bill Shannon <Bill.Shannon_at_Sun.COM> a écrit :
>
>> This issue came up a week or two ago in a bug report.
>> I looked into it enough to determine that it's incredibly
>> ugly and Windows is just broken.
>>
>> As I remember...
>>
>> After closing a socket, the socket can be left in a "timed wait"
>> state for some time after the program has exited. Unless you use
>> the "reuse address" flag, a program can't bind to the socket even
>> though no other program is using the socket.
>>
>> On Unix, "reuse address" allows you to bind to sockets that are in
>> this state. It doesn't allow you to bind to sockets that are
>> actively open and in use by another program.
>>
>> On Windows, "reuse address" allows you to bind to the socket even
>> though another program is actively using the socket.
>>
>> I never figured out if there was a way to get the Unix behavior on
>> Windows. There might be at the C level, but probably not at the
>> Java level.
>>
>> Not using "reuse address" on Windows means that in some cases
>> (server crash? server restart?) you won't be able to bind to the
>> socket you need.
>>
>> At least, that's my understanding. Hopefully someone with deeper
>> understanding of this issue can tell us what to do...
>>
>> Maybe someone should consult with one of the JDK networking experts
>
> Working with the nio team on it.
>
> -- Jeanfrancois