C# 클래스 SharpCifs.Netbios.NbtAddress

This class represents a NetBIOS over TCP/IP address.
This class represents a NetBIOS over TCP/IP address. Under normal conditions, users of jCIFS need not be concerned with this class as name resolution and session services are handled internally by the smb package.

Applications can use the methods getLocalHost, getByName, and getAllByAddress to create a new NbtAddress instance. This class is symmetric with System.Net.IPAddress .

About NetBIOS: The NetBIOS name service is a dynamic distributed service that allows hosts to resolve names by broadcasting a query, directing queries to a server such as Samba or WINS. NetBIOS is currently the primary networking layer for providing name service, datagram service, and session service to the Microsoft Windows platform. A NetBIOS name can be 15 characters long and hosts usually registers several names on the network. From a Windows command prompt you can see what names a host registers with the nbtstat command.

 C:\>nbtstat -a 192.168.1.15 NetBIOS Remote Machine Name Table Name               Type         Status --------------------------------------------- JMORRIS2        <00>  UNIQUE      Registered BILLING-NY      <00>  GROUP       Registered JMORRIS2        <03>  UNIQUE      Registered JMORRIS2        <20>  UNIQUE      Registered BILLING-NY      <1E>  GROUP       Registered JMORRIS         <03>  UNIQUE      Registered MAC Address = 00-B0-34-21-FA-3B 

The hostname of this machine is JMORRIS2. It is a member of the group(a.k.a workgroup and domain) BILLING-NY. To obtain an System.Net.IPAddress for a host one might do:

 InetAddress addr = NbtAddress.getByName( "jmorris2" ).getInetAddress(); 

From a UNIX platform with Samba installed you can perform similar diagnostics using the nmblookup utility.

파일 보기 프로젝트 열기: brandonprry/Potato 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
MasterBrowserName string
SmbserverName string

공개 메소드들

메소드 설명
Equals ( object obj ) : bool

Determines if this address is equal two another.

Determines if this address is equal two another. Only the IP Addresses are compared. Similar to the GetHashCode() method, the comparison is based on the integer IP address and not the string representation.

FirstCalledName ( ) : string
GetAddress ( ) : byte[]

Returns the raw IP address of this NbtAddress.

Returns the raw IP address of this NbtAddress. The result is in network byte order: the highest order byte of the address is in getAddress()[0].

GetAllByAddress ( NbtAddress addr ) : SharpCifs.Netbios.NbtAddress[]

Retrieve all addresses of a host by it's address.

Retrieve all addresses of a host by it's address. NetBIOS hosts can have many names for a given IP address. The name and IP address make the NetBIOS address. This provides a way to retrieve the other names for a host with the same IP address.

GetAllByAddress ( string host ) : SharpCifs.Netbios.NbtAddress[]

Retrieve all addresses of a host by it's address.

Retrieve all addresses of a host by it's address. NetBIOS hosts can have many names for a given IP address. The name and IP address make the NetBIOS address. This provides a way to retrieve the other names for a host with the same IP address.

GetAllByAddress ( string host, int type, string scope ) : SharpCifs.Netbios.NbtAddress[]

Retrieve all addresses of a host by it's address.

Retrieve all addresses of a host by it's address. NetBIOS hosts can have many names for a given IP address. The name and IP address make the NetBIOS address. This provides a way to retrieve the other names for a host with the same IP address. See GetByName(string) for a description of type and scope.

GetAllByName ( string host, int type, string scope, IPAddress svr ) : SharpCifs.Netbios.NbtAddress[]
GetByName ( string host ) : NbtAddress

Determines the address of a host given it's host name.

Determines the address of a host given it's host name. The name can be a NetBIOS name like "freto" or an IP address like "192.168.1.15". It cannot be a DNS name; the analygous Jcifs.UniAddress or System.Net.IPAddress getByName methods can be used for that.

GetByName ( string host, int type, string scope ) : NbtAddress

Determines the address of a host given it's host name.

Determines the address of a host given it's host name. NetBIOS names also have a type. Types(aka Hex Codes) are used to distiquish the various services on a host. <a href="../../../nbtcodes.html">Here is a fairly complete list of NetBIOS hex codes. Scope is not used but is still functional in other NetBIOS products and so for completeness it has been implemented. A scope of null or "" signifies no scope.

GetByName ( string host, int type, string scope, IPAddress svr ) : NbtAddress
GetHashCode ( ) : int

Returns a hashcode for this IP address.

Returns a hashcode for this IP address. The hashcode comes from the IP address and is not generated from the string representation. So because NetBIOS nodes can have many names, all names associated with an IP will have the same hashcode.

GetHostAddress ( ) : string

Returns this IP adress as a string in the form "%d.%d.%d.%d".

GetHostName ( ) : string

The hostname of this address.

The hostname of this address. If the hostname is null the local machines IP address is returned.

GetHosts ( ) : SharpCifs.Netbios.NbtAddress[]
GetInetAddress ( ) : IPAddress

To convert this address to an InetAddress.

To convert this address to an InetAddress.

GetLocalHost ( ) : NbtAddress

Retrieves the local host address.

Retrieves the local host address.

GetLocalName ( ) : Name
GetMacAddress ( ) : byte[]

Retrieves the MAC address of the remote network interface.

Retrieves the MAC address of the remote network interface. Samba returns all zeros.

GetNameType ( ) : int

Returned the hex code associated with this name(e.g.

Returned the hex code associated with this name(e.g. 0x20 is for the file service)

GetNodeType ( ) : int

Checks the node type of this address.

Checks the node type of this address.

GetWinsAddress ( ) : IPAddress
IsActive ( ) : bool

Determines if this address is active.

Determines if this address is active.

IsBeingDeleted ( ) : bool

Determines if this address in the process of being deleted.

Determines if this address in the process of being deleted.

IsGroupAddress ( ) : bool

Determines if the address is a group address.

Determines if the address is a group address. This is also known as a workgroup name or group name.

IsInConflict ( ) : bool

Determines if this address in conflict with another address.

Determines if this address in conflict with another address.

IsPermanent ( ) : bool

Determines if this address is set to be permanent.

Determines if this address is set to be permanent.

IsWins ( IPAddress svr ) : bool
NextCalledName ( ) : string
ToString ( ) : string

Returns the string representaion of this address.

비공개 메소드들

메소드 설명
CacheAddress ( Name hostName, NbtAddress addr ) : void
CacheAddress ( Name hostName, NbtAddress addr, long expiration ) : void
CacheAddressArray ( NbtAddress addrs ) : void
CheckData ( ) : void
CheckLookupTable ( Name name ) : object
CheckNodeStatusData ( ) : void
DoNameQuery ( Name name, IPAddress svr ) : NbtAddress
GetCachedAddress ( Name hostName ) : NbtAddress
NbtAddress ( ) : System
NbtAddress ( Name hostName, int address, bool groupName, int nodeType ) : System
NbtAddress ( Name hostName, int address, bool groupName, int nodeType, bool isBeingDeleted, bool isInConflict, bool isActive, bool isPermanent, byte macAddress ) : System
SwitchWins ( ) : IPAddress
UpdateLookupTable ( Name name ) : void

메소드 상세

Equals() 공개 메소드

Determines if this address is equal two another.
Determines if this address is equal two another. Only the IP Addresses are compared. Similar to the GetHashCode() method, the comparison is based on the integer IP address and not the string representation.
public Equals ( object obj ) : bool
obj object
리턴 bool

FirstCalledName() 공개 메소드

public FirstCalledName ( ) : string
리턴 string

GetAddress() 공개 메소드

Returns the raw IP address of this NbtAddress.
Returns the raw IP address of this NbtAddress. The result is in network byte order: the highest order byte of the address is in getAddress()[0].
public GetAddress ( ) : byte[]
리턴 byte[]

GetAllByAddress() 공개 정적인 메소드

Retrieve all addresses of a host by it's address.
Retrieve all addresses of a host by it's address. NetBIOS hosts can have many names for a given IP address. The name and IP address make the NetBIOS address. This provides a way to retrieve the other names for a host with the same IP address.
if address cannot be resolved
public static GetAllByAddress ( NbtAddress addr ) : SharpCifs.Netbios.NbtAddress[]
addr NbtAddress the address to query
리턴 SharpCifs.Netbios.NbtAddress[]

GetAllByAddress() 공개 정적인 메소드

Retrieve all addresses of a host by it's address.
Retrieve all addresses of a host by it's address. NetBIOS hosts can have many names for a given IP address. The name and IP address make the NetBIOS address. This provides a way to retrieve the other names for a host with the same IP address.
if there is an error resolving the name ///
public static GetAllByAddress ( string host ) : SharpCifs.Netbios.NbtAddress[]
host string hostname to lookup all addresses for
리턴 SharpCifs.Netbios.NbtAddress[]

GetAllByAddress() 공개 정적인 메소드

Retrieve all addresses of a host by it's address.
Retrieve all addresses of a host by it's address. NetBIOS hosts can have many names for a given IP address. The name and IP address make the NetBIOS address. This provides a way to retrieve the other names for a host with the same IP address. See GetByName(string) for a description of type and scope.
if there is an error resolving the name ///
public static GetAllByAddress ( string host, int type, string scope ) : SharpCifs.Netbios.NbtAddress[]
host string hostname to lookup all addresses for
type int the hexcode of the name
scope string the scope of the name
리턴 SharpCifs.Netbios.NbtAddress[]

GetAllByName() 공개 정적인 메소드

public static GetAllByName ( string host, int type, string scope, IPAddress svr ) : SharpCifs.Netbios.NbtAddress[]
host string
type int
scope string
svr System.Net.IPAddress
리턴 SharpCifs.Netbios.NbtAddress[]

GetByName() 공개 정적인 메소드

Determines the address of a host given it's host name.
Determines the address of a host given it's host name. The name can be a NetBIOS name like "freto" or an IP address like "192.168.1.15". It cannot be a DNS name; the analygous Jcifs.UniAddress or System.Net.IPAddress getByName methods can be used for that.
if there is an error resolving the name ///
public static GetByName ( string host ) : NbtAddress
host string hostname to resolve
리턴 NbtAddress

GetByName() 공개 정적인 메소드

Determines the address of a host given it's host name.
Determines the address of a host given it's host name. NetBIOS names also have a type. Types(aka Hex Codes) are used to distiquish the various services on a host. <a href="../../../nbtcodes.html">Here is a fairly complete list of NetBIOS hex codes. Scope is not used but is still functional in other NetBIOS products and so for completeness it has been implemented. A scope of null or "" signifies no scope.
if there is an error resolving the name ///
public static GetByName ( string host, int type, string scope ) : NbtAddress
host string the name to resolve
type int the hex code of the name
scope string the scope of the name
리턴 NbtAddress

GetByName() 공개 정적인 메소드

public static GetByName ( string host, int type, string scope, IPAddress svr ) : NbtAddress
host string
type int
scope string
svr System.Net.IPAddress
리턴 NbtAddress

GetHashCode() 공개 메소드

Returns a hashcode for this IP address.
Returns a hashcode for this IP address. The hashcode comes from the IP address and is not generated from the string representation. So because NetBIOS nodes can have many names, all names associated with an IP will have the same hashcode.
public GetHashCode ( ) : int
리턴 int

GetHostAddress() 공개 메소드

Returns this IP adress as a string in the form "%d.%d.%d.%d".
public GetHostAddress ( ) : string
리턴 string

GetHostName() 공개 메소드

The hostname of this address.
The hostname of this address. If the hostname is null the local machines IP address is returned.
public GetHostName ( ) : string
리턴 string

GetHosts() 공개 정적인 메소드

public static GetHosts ( ) : SharpCifs.Netbios.NbtAddress[]
리턴 SharpCifs.Netbios.NbtAddress[]

GetInetAddress() 공개 메소드

To convert this address to an InetAddress.
To convert this address to an InetAddress.
public GetInetAddress ( ) : IPAddress
리턴 System.Net.IPAddress

GetLocalHost() 공개 정적인 메소드

Retrieves the local host address.
Retrieves the local host address.
/// This is not likely as the IP returned /// by InetAddress should be available ///
public static GetLocalHost ( ) : NbtAddress
리턴 NbtAddress

GetLocalName() 공개 정적인 메소드

public static GetLocalName ( ) : Name
리턴 Name

GetMacAddress() 공개 메소드

Retrieves the MAC address of the remote network interface.
Retrieves the MAC address of the remote network interface. Samba returns all zeros.
/// if the host cannot be resolved to /// determine the MAC address. ///
public GetMacAddress ( ) : byte[]
리턴 byte[]

GetNameType() 공개 메소드

Returned the hex code associated with this name(e.g.
Returned the hex code associated with this name(e.g. 0x20 is for the file service)
public GetNameType ( ) : int
리턴 int

GetNodeType() 공개 메소드

Checks the node type of this address.
Checks the node type of this address.
if the host cannot be resolved to find out. ///
public GetNodeType ( ) : int
리턴 int

GetWinsAddress() 공개 정적인 메소드

public static GetWinsAddress ( ) : IPAddress
리턴 System.Net.IPAddress

IsActive() 공개 메소드

Determines if this address is active.
Determines if this address is active.
if the host cannot be resolved to find out. ///
public IsActive ( ) : bool
리턴 bool

IsBeingDeleted() 공개 메소드

Determines if this address in the process of being deleted.
Determines if this address in the process of being deleted.
if the host cannot be resolved to find out. ///
public IsBeingDeleted ( ) : bool
리턴 bool

IsGroupAddress() 공개 메소드

Determines if the address is a group address.
Determines if the address is a group address. This is also known as a workgroup name or group name.
if the host cannot be resolved to find out. ///
public IsGroupAddress ( ) : bool
리턴 bool

IsInConflict() 공개 메소드

Determines if this address in conflict with another address.
Determines if this address in conflict with another address.
if the host cannot be resolved to find out. ///
public IsInConflict ( ) : bool
리턴 bool

IsPermanent() 공개 메소드

Determines if this address is set to be permanent.
Determines if this address is set to be permanent.
if the host cannot be resolved to find out. ///
public IsPermanent ( ) : bool
리턴 bool

IsWins() 공개 정적인 메소드

public static IsWins ( IPAddress svr ) : bool
svr IPAddress
리턴 bool

NextCalledName() 공개 메소드

public NextCalledName ( ) : string
리턴 string

ToString() 공개 메소드

Returns the string representaion of this address.
public ToString ( ) : string
리턴 string

프로퍼티 상세

MasterBrowserName 공개적으로 정적으로 프로퍼티

This is a special name for querying the master browser that serves the list of hosts found in "Network Neighborhood".
This is a special name for querying the master browser that serves the list of hosts found in "Network Neighborhood".
public static string MasterBrowserName
리턴 string

SmbserverName 공개적으로 정적으로 프로퍼티

A special generic name specified when connecting to a host for which a name is not known.
A special generic name specified when connecting to a host for which a name is not known. Not all servers respond to this name.
public static string SmbserverName
리턴 string