|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jcifs.netbios.NbtNameServiceClient
Applications should use the NbtAddress
class for
interacting with the netbios. This class is for lower-level control over
the name service and would only be usefull for netbios centric tools.
This class provides the name service functionality for the netbios networking protocol. The netbios name service is a dynamic distributed service that allows hosts to resolve names by broadcasting a query, directing querys to a server such as Samba or WINS. A netbios name consists of two parts, a 15 character string and a 1 byte type. A netbios node usually registers several names on the network. You can see what names a Windows machine registers with the nbtstat command.
C:\>nbtstat -a 192.168.1.15 NetBIOS Remote Machine Name Table Name Type Status --------------------------------------------- ANGUS <00> UNIQUE Registered RSCH-NY <00> GROUP Registered ANGUS <03> UNIQUE Registered ANGUS <20> UNIQUE Registered RSCH-NY <1E> GROUP Registered MIALLEN <03> UNIQUE Registered MAC Address = 00-A0-34-21-FA-3B
The hostname of this machine is ANGUS
. It is
a member of the group(or workgroup) RSCH-NY
. The
hexadecimal values are the names types. The types correspond to
the services that the host provides. Usually the <00>
type is the only of interest as it is registered by all hosts. Here
is a list of what services correspond to what hex codes.
Constructor Summary | |
NbtNameServiceClient()
Instantiate a new client. |
|
NbtNameServiceClient(int port)
Instantiate a new client. |
|
NbtNameServiceClient(int port,
InetAddress laddr)
Instantiate a new client. |
Method Summary | |
NbtAddress[] |
getAllByName(String name)
Resloves the addresses of all hosts given a name(presumably a workgroup name). |
NbtAddress[] |
getAllByName(String name,
int type,
String scope,
boolean recurDesired)
Resloves the addresses of all hosts given a hostname(presumably a workgroup name). |
NbtAddress |
getByName(String name)
Determines the address of a host given it's host name. |
NbtAddress |
getByName(String name,
int type,
String scope,
boolean recurDesired)
Determines the address of a host given it's host name. |
NbtAddress |
getLocalHostName()
Retrieve the local host name. |
NbtAddress[] |
getNodeStatus(NbtAddress addr)
Do a node status on an address. |
void |
setLocalHostName(String name,
String scope)
Set the local host name that the client uses when connecting to other hosts. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public NbtNameServiceClient() throws SocketException
MultiDatagramSocket
cannot be startedpublic NbtNameServiceClient(int port) throws SocketException
port
- the port the client should bind to.MultiDatagramSocket
cannot be startedpublic NbtNameServiceClient(int port, InetAddress laddr) throws SocketException
port
- the port the client should run onladdr
- the address of the interface the client should bindMultiDatagramSocket
cannot be startedMethod Detail |
public void setLocalHostName(String name, String scope)
name
parameter is empty or null a name will
try resolve the name of the machine using standard netbios queries. If
that fails the first label of the DNS name is use. If that fails the name
JCIFS_XXX
is used where XXX
is a random number.name
- the name this client should masquarade asscope
- the scope of the client's name. This is generally not used but if it is, it must be setpublic NbtAddress getLocalHostName()
setLocalHostName(String name, String scope)
public NbtAddress getByName(String name) throws UnknownNbtHostException
name
- hostname to resolvepublic NbtAddress getByName(String name, int type, String scope, boolean recurDesired) throws UnknownNbtHostException
type
. Types(aka Hex Codes)
are used to distiquish the various services on a host. Here is
a fairly complete list of netbios hex codes. Scope is not used but is
still functional on Windows machines and so for completeness it has been
implemented. A scope
of null
or ""
signifies no scope.name
- the name to resolvetype
- the hex code of the namescope
- the scope of the nameis
- recursion desiredpublic NbtAddress[] getAllByName(String name) throws UnknownNbtHostException
name
- groupname to lookuppublic NbtAddress[] getAllByName(String name, int type, String scope, boolean recurDesired) throws UnknownNbtHostException
getByName(java.lang.String)
for a description of type
and scope
.name
- group name to lookuptype
- the hexcode of the nameis
- recursion desiredpublic NbtAddress[] getNodeStatus(NbtAddress addr) throws UnknownNbtHostException
addr
- the address to do a node status onNbtAddress.getAllByAddress( NbtAddress addr )
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |