On Wed, Feb 2, 2011 at 5:47 PM, Robert Fischer <[email protected]> wrote:

> Wait—let me get this straight.  Even if you close a socket, you've
> still consumed a port number, and there's no way to free the port
> numbers for re-use?

No, not at all.  If the socket has been closed long enough, the kernel
will free the port number, and it can be reallocated.  I was simply
speculating that the OP was opening ports faster than he was closing
them, but apparently not.

> How does SO_REUSEADDR/setReuseAddress(boolean) play into this?

Normally the kernel waits a while after the socket is closed before
the port can be reused, so that any incoming packets from the remote
socket can be discarded.  SO_REUSEADDR suppresses this delay, at a
risk of accepting a packet from a previous connection to the same
host.


-- 
GMail doesn't have rotating .sigs, but you can see mine at
http://www.ccil.org/~cowan/signatures

-- 
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en.

Reply via email to