Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

nbtstat from Java app

Status
Not open for further replies.

themanfalconar

Technical User
Sep 13, 2003
10
EU
Hi there,

Is there a way to check the NetBIOS connections of a particular host (using its hostname)? I'm writing an application that does the following:

1. Queries our user database to find the hostnames associated with that user.
2. Checks the NetBIOS connections of those hosts to see if the user has an active NetBIOS connection.

[by the way, this app runs on Windows only]

At present, the only way I can think of doing this is to execute 'nbtstat -a hostname > tempfile.tmp' as a system command within the Java app, then parse the tempfile and attempt to match the username with the text in the file.

I think that this is a pretty shabby way of doing it, and so I'm wondering if any of you guys/gals can think of a better way.

Many thanks in advance,

Dan
 
You could try to use the NetBios-Port (I only know it from internet-worms, allways trying to connect me on that port) with a socket, but I guess MS didn't open the source of their netbios protocoll, to do much further.

Perhaps the samba-people have this know-how, but I guess it's not java, but c/ c++.

seeking a job as java-programmer in Berlin:
 
Thanks for your post. Do you have any idea how I can actually use this NetBIOS port? I'm completely unfamiliar with the concept.

It seems that I'm also have trouble using the method I suggested, i.e. redirecting the output of the nbtstat command to a text file and then reading that... The problem I am having in this case is that the nbtstat command takes a few seconds to actually finish and hence create the file that needs to be checked. I've had to implement a 'wait' section of the program to wait for the file to appear. This, however, is proving problematic and is really slow.

Please, please, someone come up with a better solution than this... I'm sure there must be one. Are there no IP tools for Java?

Regards,

Dan Falconar
 
>>>>Are there no IP tools for Java?

Perhaps :
As Stefan said earlier, this is a more C/C++ issue- the standard Java kit (SDK) does not provide many APIs for interfacing with the base OS, because ths is not what Java is about - mainly die to the fact that most OS interface code is not platform independant.

In short, you're in the wrong forum. You need to write some C to sort this problem, not Java.

--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top