[jcifs] SmbFile: BindException problem while browsingworkgro ups

Christopher R. Hertel crh at ubiqx.mn.org
Thu Nov 8 17:20:16 EST 2001

"Allen, Michael B (RSCH)" wrote:
> So you run your program once, it works, but if you run it again within a short period of time it fails to bind that address? If so, it sounds like the OS is not releasing the socket from the last run.

Yeah, the more I think about it the more it sounds as though you're hitting
an SO_REUSEADDR kind of issue.

Does W2K have something like a netstat command?  If so, look to see if the
port is in TIME_WAIT state.  If you try to re-bind to the port before it
times out, the bind will fail.

Again, this is only a problem if you try to re-bind to the same port after a
close and it only happens (or only should happen) in TCP...not in UDP.

All that said, there could be a problem specific to this JVM
implementation.  For example, even if you request 'any' port in the Java
code, the JVM may try to re-use a port which it knows was closed (instead of
relying on the underlying OS to find a free port).

There are a lot of guesses here, but I'm pretty sure that the problem is
related to the TIME_WAIT state.

See: http://www.lcg.org/sock-faq/detail.php3?id=13

Chris -)-----

Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org

More information about the jcifs mailing list