Subject: SmbFile.exists( "smb://server" ) - msg#00123
List: network.samba.java
I was fiddling with the Exists.java tool in the examples directory and
noticed that when given a URL with just a server name it sends a name
query. That is:
$ java Exists smb://server
sends a broadcast name query for SERVER<20>.
Now, that is a valid test on a broadcast NBT network. If a response to
the broadcast is received it means that there is a node claiming that
name.
Unfortuantely, I don't have my network set up for WINS testing at the
moment. What I want to know is this: If WINS is in use, does the Exists
test query the WINS server and, if so, what does it do afterward?
See, the problem I'm concerned about is that a name may exist in the WINS
database even though the machine that registered the name has been shut
down. Good behavior is that a cleanly shut-down system would release the
name first, but that doesn't always happen and some WINS implementations
are flakey. So the proper test would be to send an Adapter Status query
following the WINS lookup to verify the name.
This is just something that occurred to my troubled brain as I tried to
handle some other problem...
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@xxxxxxxxxxxx
OnLineBook --
http://ubiqx.org/cifs/ -)----- crh@xxxxxxxxx
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
Re: threading
On Sun, Feb 23, 2003 at 12:31:06AM -0500, Dan Dumont wrote:
> That's fine with me, perhaps I did not make my intentions clear. I
> don't mind if it blocks the thread. What I do mind is that it blocks
> all other threads trying to connect also.
>
> The whole program locks up while I wait for one thread to connect.
That's because blocking occurs at the host OS process level. I *believe*
that when a Java thread performs an operation that causes the JVM to call
a blocking system call, the entire JVM instance (which exists as a single
OS thread) will block.
This may depend upon the implementation, since some implementations may
behave differently (that is, they may implement threading differently).
I am doing a bit of guessing here, based on my earlier experience with
blocking DNS lookups under Java (many years ago).
Here's an interesting reference I stumbled upon:
http://www.cs.berkeley.edu/~mdw/proj/java-nbio/
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@xxxxxxxxxxxx
OnLineBook -- http://ubiqx.org/cifs/ -)----- crh@xxxxxxxxx
Next Message by Date:
click to view message preview
Re: threading
On Sat, 22 Feb 2003 23:21:22 -0600
"Christopher R. Hertel" <crh@xxxxxxxxxxxx> wrote:
> So the thread is calling a blocking syscall, and thus blocking all other
> threads as well... Is that correct?
No. That should not happen with native threads. If threads are
handled entirely in userspace it will but not with native kernelspace
threads. Actually there are different thread models that might utilize
a mixture of userspace and kernelspace threads so in theory a blocking
syscall like a read could block other threads but I've never actually
seen this happen.
Mike
--
A program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes the potential for it to be applied to tasks that are
conceptually similar and, more important, to tasks that have not
yet been conceived.
Previous Message by Thread:
click to view message preview
listFiles() problem - Access denied
Hello
everyone!
I get the following
exception when I execute the SmbFile.listFiles() on "smb://myworkgroup/"
:
jcifs.smb.SmbAuthException: Access denied
at
jcifs.smb.SmbTransport.send(SmbTransport.java:494)
at
jcifs.smb.SmbSession.sessionSetup(SmbSession.java:126)
at
jcifs.smb.SmbSession.send(SmbSession.java:102)
at
jcifs.smb.SmbTree.treeConnect(SmbTree.java:132)
at
jcifs.smb.SmbFile.connect(SmbFile.java:522)
at
jcifs.smb.SmbFile.connect0(SmbFile.java:484)
at
jcifs.smb.SmbFile.sendTransaction(SmbFile.java:460)
at
jcifs.smb.SmbFile.listFiles(SmbFile.java:1304)
at
jcifs.smb.SmbFile.listFiles(SmbFile.java:1237)
at
IPDialog$LanScanner.run(IPDialog.java:882)
On other workgroups
in the same LAN, I dont get this exception, only on
"myworkgroup".
I suspect that some
server(s) are not accessible, at all, at least without a proper
authentication.
I would be very
happy if the listFiles() method would return only the accessible servers and
leave the others out.
What I mean is, why
not get i.e. the 5 out of the 6 servers of "myworkgroup" and leave the
1 out?
Why should
"listFiles()" return "ALL" or "NOTHING" ? Why not "SOME"
?
Next Message by Thread:
click to view message preview
Re: SmbFile.exists( "smb://server" )
On Sun, 23 Feb 2003 00:36:30 -0600
"Christopher R. Hertel" <crh@xxxxxxxxxxxx> wrote:
> I was fiddling with the Exists.java tool in the examples directory and
> noticed that when given a URL with just a server name it sends a name
> query. That is:
>
> $ java Exists smb://server
>
> sends a broadcast name query for SERVER<20>.
>
> Now, that is a valid test on a broadcast NBT network. If a response to
> the broadcast is received it means that there is a node claiming that
> name.
>
> Unfortuantely, I don't have my network set up for WINS testing at the
> moment. What I want to know is this: If WINS is in use, does the Exists
> test query the WINS server and, if so, what does it do afterward?
This is all described pretty well here:
http://jcifs.samba.org/src/docs/resolver.html
> See, the problem I'm concerned about is that a name may exist in the WINS
> database even though the machine that registered the name has been shut
> down. Good behavior is that a cleanly shut-down system would release the
> name first, but that doesn't always happen and some WINS implementations
> are flakey. So the proper test would be to send an Adapter Status query
> following the WINS lookup to verify the name.
No, we don't do that. If you look at UniAddress.getByName and consider
the jcifs.netbios.wins and jcifs.resolveOrder property and what they do
the name resolution capability of jCIFS is second to none. It is equally
good at finding a good "called name". If an IP is giving it may do a
node status although only as a last resort. Again see UniAddress.java.
Mike
--
A program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes the potential for it to be applied to tasks that are
conceptually similar and, more important, to tasks that have not
yet been conceived.