IP*Works! V8

ipworks
Class Ipinfo

java.lang.Object
  |
  +--ipworks.Ipinfo

public class Ipinfo
extends java.lang.Object

The IPInfo bean is used to resolve host names to host addresses and vice-versa using asynchronous DNS. The bean provides access to other TCP/IP database functions as well.

The IPInfo bean operates asynchronously. Requests are posted to the bean by setting a property like HostName , HostAddress , ServiceName , ServicePort and then waiting for the RequestComplete event. The RequestId property identifies the request.

Up to 100 simultaneous requests can be queued at any moment. PendingRequests shows the number of pending requests, and may also be used to adjust the size of the queue (by dumping a number of the pending requests).


Constructor Summary
Ipinfo()
           
 
Method Summary
 void addIpinfoEventListener(ipworks.IpinfoEventListener l)
           
 java.lang.String config(java.lang.String configurationString)
          Sets or retrieves a beanconfiguration setting.
 void DHCPRelease()
          Releases the IP Address of the current adapter specified by AdapterIndex .
 void DHCPRenew()
          Renews the IP Address of the current adapter specified by AdapterIndex .
 void doEvents()
          Processes events from the internal message queue.
 int getAdapterCount()
          The number of adapters in the system.
 java.lang.String getAdapterDescription()
          The description of the adapter identified by AdapterIndex .
 int getAdapterDeviceIndex()
          The system index of the adapter identified by AdapterIndex .
 java.lang.String getAdapterDHCPServer()
          The DHCP server of the adapter identified by AdapterIndex .
 java.lang.String getAdapterGateway()
          The default gateway of the adapter identified by AdapterIndex .
 int getAdapterIndex()
          Sets the current adapter.
 java.lang.String getAdapterIPAddress()
          The IP address of the adapter identified by AdapterIndex .
 java.lang.String getAdapterLeaseExpires()
          The expiration date and time of the lease obtained by the adapter identified by AdapterIndex .
 java.lang.String getAdapterLeaseObtained()
          The date and time of when the current lease was obtained by the adapter identified by AdapterIndex .
 java.lang.String getAdapterName()
          The name of the adapter identified by AdapterIndex .
 java.lang.String getAdapterOtherIPAddresses()
          Other IP addresses leased by the adapter specified by AdapterIndex , if any.
 java.lang.String getAdapterPhysicalAddress()
          The physical address of the adapter identified by AdapterIndex .
 java.lang.String getAdapterPrimaryWINSServer()
          The primary WINS server of the adapter identified by AdapterIndex .
 java.lang.String getAdapterSecondaryWINSServer()
          The secondary WINS server of the adapter identified by AdapterIndex .
 java.lang.String getAdapterSubnetMask()
          The subnet of the adapter identified by AdapterIndex .
 java.lang.String getAdapterType()
          The type of adapter identified by AdapterIndex .
 java.lang.String getDHCPScope()
          The DHCP Scope of the DHCP server.
 java.lang.String getDNSServer()
          The DNS server for the adapter specified by LocalHost .
 java.lang.String getDomainName()
          The current network domain on which the system resides.
 java.lang.String getHostAddress()
          An Internet Address in dotted format.
 java.lang.String getHostAliases()
          Other names corresponding to the host with name HostName.
 java.lang.String getHostName()
          The Domain Name of an Internet host.
 java.lang.String getLocalHost()
          The name of the local host.
 java.lang.String getMAC(java.lang.String IPAddress)
          Returns the MAC address of the network interface at IPAddress .
 java.lang.String getNodeType()
          The type of node for the system.
 java.lang.String getOtherAddresses()
          Other addresses for the host identified by HostName (for multihomed hosts).
 java.lang.String getOtherDNSServers()
          Other DNS servers configured for the host machine.
 int getPendingRequests()
          The number of requests awaiting for completion.
 int getRequestId()
          The handle of the last request.
 java.lang.String getServiceAliases()
          Other names by which the service specified by ServiceName / ServicePort is known.
 java.lang.String getServiceName()
          A name for a service.
 int getServicePort()
          A port number for a service.
 java.lang.String getServiceProtocol()
          The protocol of the service specified by ServiceName / ServicePort .
 boolean isAdapterDHCPEnabled()
          Shows whether or not the adapter identified by AdapterIndex has DHCP Enabled.
 boolean isAdapterUsesWINS()
          Shows whether or not the adapter identified by AdapterIndex uses WINS.
 boolean isARPProxy()
          Shows whether the adapter can act as an ARP proxy.
 boolean isDNSEnabled()
          Shows whether or not the adapter identified by LocalHost has DNS Enabled.
 boolean isRoutingEnabled()
          Shows whether routing is enabled on the adapter.
 void removeIpinfoEventListener(ipworks.IpinfoEventListener l)
           
 void reset()
          Resets the bean stopping all pending requests and refreshing network information.
 java.lang.String resolveAddress(java.lang.String hostAddress)
          Resolve an IP address.
 java.lang.String resolveName(java.lang.String hostName)
          Resolve a host name.
 void setAdapterIndex(int adapterIndex)
          Sets the current adapter.
 void setHostAddress(java.lang.String hostAddress)
          An Internet Address in dotted format.
 void setHostName(java.lang.String hostName)
          The Domain Name of an Internet host.
 void setPendingRequests(int pendingRequests)
          The number of requests awaiting for completion.
 void setServiceName(java.lang.String serviceName)
          A name for a service.
 void setServicePort(int servicePort)
          A port number for a service.
 void setServiceProtocol(java.lang.String serviceProtocol)
          The protocol of the service specified by ServiceName / ServicePort .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Ipinfo

public Ipinfo()
Method Detail

getAdapterCount

public int getAdapterCount()
The number of adapters in the system.

The AdapterCount property shows how many adapters are installed in the system. You can set the AdapterIndex to 1 through AdapterCount , and then examine the Adapter properties such as AdapterDescription , AdapterName , and AdapterIPAddress to retreive information about each adapter.

NOTE: This functionality is only available in Windows.


getAdapterDescription

public java.lang.String getAdapterDescription()
The description of the adapter identified by AdapterIndex .

The description of the adapter identified by AdapterIndex , as returned from the system.

NOTE: This functionality is only available in Windows.


getAdapterDeviceIndex

public int getAdapterDeviceIndex()
The system index of the adapter identified by AdapterIndex .

The system index of the adapter identified by AdapterIndex , as returned by the system.

NOTE: This functionality is only available in Windows.


isAdapterDHCPEnabled

public boolean isAdapterDHCPEnabled()
Shows whether or not the adapter identified by AdapterIndex has DHCP Enabled.

Dynamic Host Configuration Protocol (DHCP) is used for automatically assigning IP Addresses on a network.

NOTE: This functionality is only available in Windows.


getAdapterDHCPServer

public java.lang.String getAdapterDHCPServer()
The DHCP server of the adapter identified by AdapterIndex .

Dynamic Host Configuration Protocol (DHCP) is used for automatically assigning IP Addresses on a network.

NOTE: This functionality is only available in Windows.


getAdapterGateway

public java.lang.String getAdapterGateway()
The default gateway of the adapter identified by AdapterIndex .

The default gateway of the adapter identified by AdapterIndex , as returned by the system.

NOTE: This functionality is only available in Windows.


getAdapterIndex

public int getAdapterIndex()
Sets the current adapter.

When set, the bean asks the system for information on the adapter with an index of AdapterIndex . If the system has information, the Adapter properties will be populated with the data returned.

AdapterCount is the number of adapters located in the system.

NOTE: This functionality is only available in Windows.


setAdapterIndex

public void setAdapterIndex(int adapterIndex)
                     throws IPWorksException
Sets the current adapter.

When set, the bean asks the system for information on the adapter with an index of AdapterIndex . If the system has information, the Adapter properties will be populated with the data returned.

AdapterCount is the number of adapters located in the system.

NOTE: This functionality is only available in Windows.

IPWorksException

getAdapterIPAddress

public java.lang.String getAdapterIPAddress()
The IP address of the adapter identified by AdapterIndex .

The IP address of the adapter identified by AdapterIndex , as returned by the system.

NOTE: This functionality is only available in Windows.


getAdapterLeaseExpires

public java.lang.String getAdapterLeaseExpires()
The expiration date and time of the lease obtained by the adapter identified by AdapterIndex .

The expiration date and time of the lease obtained by the adapter identified by AdapterIndex , as returned by the system.

NOTE: This functionality is only available in Windows.


getAdapterLeaseObtained

public java.lang.String getAdapterLeaseObtained()
The date and time of when the current lease was obtained by the adapter identified by AdapterIndex .

The date and time of when the current lease was obtained by the adapter identified by AdapterIndex , as returned by the system.

NOTE: This functionality is only available in Windows.


getAdapterName

public java.lang.String getAdapterName()
The name of the adapter identified by AdapterIndex .

The name of the adapter identified by AdapterIndex , as returned from the system.

NOTE: This functionality is only available in Windows.


getAdapterOtherIPAddresses

public java.lang.String getAdapterOtherIPAddresses()
Other IP addresses leased by the adapter specified by AdapterIndex , if any.

A space separated list of any other IP addresses leased by the adapter specified by AdapterIndex , if any.

NOTE: This functionality is only available in Windows.


getAdapterPhysicalAddress

public java.lang.String getAdapterPhysicalAddress()
The physical address of the adapter identified by AdapterIndex .

The physical address of the adapter identified by AdapterIndex , as returned from the system.

NOTE: This functionality is only available in Windows.


getAdapterPrimaryWINSServer

public java.lang.String getAdapterPrimaryWINSServer()
The primary WINS server of the adapter identified by AdapterIndex .

The primary WINS server of the adapter identified by AdapterIndex , as returned from the system.

NOTE: This functionality is only available in Windows.


getAdapterSecondaryWINSServer

public java.lang.String getAdapterSecondaryWINSServer()
The secondary WINS server of the adapter identified by AdapterIndex .

The secondary WINS server of the adapter identified by AdapterIndex , as returned from the system.

NOTE: This functionality is only available in Windows.


getAdapterSubnetMask

public java.lang.String getAdapterSubnetMask()
The subnet of the adapter identified by AdapterIndex .

The subnet of the adapter identified by AdapterIndex , as returned from the system.

NOTE: This functionality is only available in Windows.


getAdapterType

public java.lang.String getAdapterType()
The type of adapter identified by AdapterIndex .

The type of adapter identified by AdapterIndex , as returned from the system.

Possible values include:

OTHER
Other
ETHERNET
Ethernet
TOKENRING
Token Ring
FDDI
Fibre Distributed Data Interface
PPP
Point-to-Point Protocol
LOOPBACK
Loopback
SLIP
Serial Line Internet Protocol

NOTE: This functionality is only available in Windows.


isAdapterUsesWINS

public boolean isAdapterUsesWINS()
Shows whether or not the adapter identified by AdapterIndex uses WINS.

Shows whether or not the adapter identified by AdapterIndex uses WINS. Windows Internet Name Service (WINS) is a name resolution service which is used to resolve Windows network hostnames to IP addresses.

NOTE: This functionality is only available in Windows.


isARPProxy

public boolean isARPProxy()
Shows whether the adapter can act as an ARP proxy.

The adapter is identified by AdapterIndex .

NOTE: This functionality is only available in Windows.


getDHCPScope

public java.lang.String getDHCPScope()
The DHCP Scope of the DHCP server.

If the DHCP Server.is true, the DHCPScope is the DHCP Scope of the DHCP server. The DHCP Scope is a range of IP addresses which the DHCP server can lease to clients.

NOTE: This functionality is only available in Windows.


isDNSEnabled

public boolean isDNSEnabled()
Shows whether or not the adapter identified by LocalHost has DNS Enabled.

If true, DNS is enabled, and name resolution will be available.

NOTE: This functionality is only available in Windows.


getDNSServer

public java.lang.String getDNSServer()
The DNS server for the adapter specified by LocalHost .

The DNS server for the adapter specified by LocalHost , as returned by the system.

NOTE: This functionality is only available in Windows.


getDomainName

public java.lang.String getDomainName()
The current network domain on which the system resides.

The domain name of which the system is joined.

NOTE: This functionality is only available in Windows.


getHostAddress

public java.lang.String getHostAddress()
An Internet Address in dotted format. When set, it initiates a search for the corresponding host name.

The HostAddress property shows the IP address (in internet dotted format aaa.bbb.ccc.ddd) of the host whose domain name is specified by HostName

If HostAddress is set to an IP address, a search is initiated for the corresponding host names(s).

The RequestComplete event is fired when the search is complete. The RequestId property identifies the pending request.

Example (Resolve an Address)

 IPInfoControl.HostAddress = "10.0.1.10"
 While IPInfoControl.PendingRequests > 0
     IPInfoControl.DoEvents()
 End While
 ResolvedName = IPInfoControl.HostName 


setHostAddress

public void setHostAddress(java.lang.String hostAddress)
                    throws IPWorksException
An Internet Address in dotted format. When set, it initiates a search for the corresponding host name.

The HostAddress property shows the IP address (in internet dotted format aaa.bbb.ccc.ddd) of the host whose domain name is specified by HostName

If HostAddress is set to an IP address, a search is initiated for the corresponding host names(s).

The RequestComplete event is fired when the search is complete. The RequestId property identifies the pending request.

Example (Resolve an Address)

 IPInfoControl.HostAddress = "10.0.1.10"
 While IPInfoControl.PendingRequests > 0
     IPInfoControl.DoEvents()
 End While
 ResolvedName = IPInfoControl.HostName 

IPWorksException

getHostAliases

public java.lang.String getHostAliases()
Other names corresponding to the host with name HostName.

The HostAliases property contains a list of alternate names for the host specified by HostName and HostAddress separated by spaces.


getHostName

public java.lang.String getHostName()
The Domain Name of an Internet host. When set, it initiates a search for the corresponding address(es).

The HostName property shows the domain name of the host whose IP address is specified by HostAddress .

If HostName is set to a domain name, a search is initiated for the corresponding host address(s).

The RequestComplete event is fired when the search is complete. The RequestId property identifies the pending request.

Example (Resolve a Name)

 IPInfoControl.HostName = "MyHostName"
 While IPInfoControl.PendingRequests > 0
     IPInfoControl.DoEvents()
 End While
 ResolvedAddress = IPInfoControl.HostAddress 


setHostName

public void setHostName(java.lang.String hostName)
                 throws IPWorksException
The Domain Name of an Internet host. When set, it initiates a search for the corresponding address(es).

The HostName property shows the domain name of the host whose IP address is specified by HostAddress .

If HostName is set to a domain name, a search is initiated for the corresponding host address(s).

The RequestComplete event is fired when the search is complete. The RequestId property identifies the pending request.

Example (Resolve a Name)

 IPInfoControl.HostName = "MyHostName"
 While IPInfoControl.PendingRequests > 0
     IPInfoControl.DoEvents()
 End While
 ResolvedAddress = IPInfoControl.HostAddress 

IPWorksException

getLocalHost

public java.lang.String getLocalHost()
The name of the local host.

The LocalHost property contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.


getNodeType

public java.lang.String getNodeType()
The type of node for the system.

Possible values include "BROADCAST", "PEERTOPEER", "MIXED", "HYBRID".

NOTE: This functionality is only available in Windows.


getOtherAddresses

public java.lang.String getOtherAddresses()
Other addresses for the host identified by HostName (for multihomed hosts).

The OtherAddresses property contains a list of alternate addresses for the host specified by HostName and HostAddress separated by spaces. Most hosts have only one IP interface. This property is useful when querying multihomed hosts (hosts with more than one interface).


getOtherDNSServers

public java.lang.String getOtherDNSServers()
Other DNS servers configured for the host machine.

OtherDNSServers is a space-separated list of DNS servers configured for the host machine. Note that the primary server is provided in the DNSServer property.

NOTE: This functionality is only available in Windows.


getPendingRequests

public int getPendingRequests()
The number of requests awaiting for completion.

The PendingRequests property serves two functions: it shows the number of requests that are pending completion, but it can also be used to adjust the size of the queue by dumping part of or all the pending requests.

To cancel all the pending requests at any moment, simply set PendingRequests to 0.


setPendingRequests

public void setPendingRequests(int pendingRequests)
                        throws IPWorksException
The number of requests awaiting for completion.

The PendingRequests property serves two functions: it shows the number of requests that are pending completion, but it can also be used to adjust the size of the queue by dumping part of or all the pending requests.

To cancel all the pending requests at any moment, simply set PendingRequests to 0.

IPWorksException

getRequestId

public int getRequestId()
The handle of the last request.

The RequestId property gives the handle of the last request.

This handle can be later used to identify the request when the RequestComplete event is fired.


isRoutingEnabled

public boolean isRoutingEnabled()
Shows whether routing is enabled on the adapter.

The adapter is identified by AdapterIndex .

NOTE: This functionality is only available in Windows.


getServiceAliases

public java.lang.String getServiceAliases()
Other names by which the service specified by ServiceName / ServicePort is known.

The ServiceAliases property contains a list of alternate service names separated by spaces. In most cases, this list is empty.


getServiceName

public java.lang.String getServiceName()
A name for a service. When set, it initiates a search for the corresponding port number and protocol.

The ServiceName property shows the name of the service specified located at ServicePort .

If ServiceName is set to a service name, a search is initiated for the corresponding ServicePort and other information related to the service (if any).

The RequestComplete event is fired when the search is complete. RequestId identifies the pending request.


setServiceName

public void setServiceName(java.lang.String serviceName)
                    throws IPWorksException
A name for a service. When set, it initiates a search for the corresponding port number and protocol.

The ServiceName property shows the name of the service specified located at ServicePort .

If ServiceName is set to a service name, a search is initiated for the corresponding ServicePort and other information related to the service (if any).

The RequestComplete event is fired when the search is complete. RequestId identifies the pending request.

IPWorksException

getServicePort

public int getServicePort()
A port number for a service. When set, it initiates a search for the corresponding service name and protocol.

The ServicePort property shows the port number for the service specified by ServiceName .

If ServicePort is set to a port number, a search is initiated for the ServiceName and other information related to the service (if any).

The RequestComplete event is fired when the search is complete. RequestId identifies the pending request.


setServicePort

public void setServicePort(int servicePort)
                    throws IPWorksException
A port number for a service. When set, it initiates a search for the corresponding service name and protocol.

The ServicePort property shows the port number for the service specified by ServiceName .

If ServicePort is set to a port number, a search is initiated for the ServiceName and other information related to the service (if any).

The RequestComplete event is fired when the search is complete. RequestId identifies the pending request.

IPWorksException

getServiceProtocol

public java.lang.String getServiceProtocol()
The protocol of the service specified by ServiceName / ServicePort .

ServiceProtocol shows the protocol for the service specified by ServiceName .

Setting ServiceProtocol to a particular protocol name (for example 'udp' or 'tcp') will force a search for a service for that protocol only. If ServiceProtocol is set to "" (empty string) then the first entry for the service will be returned and ServiceProtocol will be set to the corresponding protocol.


setServiceProtocol

public void setServiceProtocol(java.lang.String serviceProtocol)
                        throws IPWorksException
The protocol of the service specified by ServiceName / ServicePort .

ServiceProtocol shows the protocol for the service specified by ServiceName .

Setting ServiceProtocol to a particular protocol name (for example 'udp' or 'tcp') will force a search for a service for that protocol only. If ServiceProtocol is set to "" (empty string) then the first entry for the service will be returned and ServiceProtocol will be set to the corresponding protocol.

IPWorksException

config

public java.lang.String config(java.lang.String configurationString)
                        throws IPWorksException
Sets or retrieves a beanconfiguration setting.

Config is a generic method available in every bean. It is used to set and retrieveconfiguration settingsfor the bean.

Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the bean, access to these internal properties is provided through the Config method.

To set a configuration setting named PROPERTY , you must call Config("PROPERTY=VALUE") , where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a configuration setting, you must call Config("PROPERTY") . The value will be returned as a string.

IPWorksException

DHCPRelease

public void DHCPRelease()
                 throws IPWorksException
Releases the IP Address of the current adapter specified by AdapterIndex .

If AdapterDHCPEnabled is true, the lease of the IP Address assigned to the current adapter specified by AdapterIndex is released.

NOTE: This functionality is only available in Windows.

IPWorksException

DHCPRenew

public void DHCPRenew()
               throws IPWorksException
Renews the IP Address of the current adapter specified by AdapterIndex .

If AdapterDHCPEnabled is true, the lease of the IP Address assigned to the current adapter specified by AdapterIndex is renewed.

NOTE: This functionality is only available in Windows.

IPWorksException

doEvents

public void doEvents()
              throws IPWorksException
Processes events from the internal message queue.

When DoEvents is called, the bean processes any available events. If no events are available, it waits for a preset period of time, and then returns.

IPWorksException

getMAC

public java.lang.String getMAC(java.lang.String IPAddress)
                        throws IPWorksException
Returns the MAC address of the network interface at IPAddress .

Returns the unique Media Access Control (MAC) address of the network interface at IPAddress .

NOTE: This functionality is only available in Windows.

IPWorksException

reset

public void reset()
           throws IPWorksException
Resets the bean stopping all pending requests and refreshing network information.

If the network configuration has changed, call this method to retrieve the latest information.

IPWorksException

resolveAddress

public java.lang.String resolveAddress(java.lang.String hostAddress)
                                throws IPWorksException
Resolve an IP address.

Resolves the IP Address HostAddress and sets HostName to the name of the host corresponding to HostAddress .

Calling this method is equivalent to setting the HostAddress property to HostAddress .

Example (Resolve an Address)

 IPInfoControl.ResolveAddress("10.0.1.10")
 While IPInfoControl.PendingRequests > 0
     IPInfoControl.DoEvents()
 End While
 ResolvedName = IPInfoControl.HostName 

IPWorksException

resolveName

public java.lang.String resolveName(java.lang.String hostName)
                             throws IPWorksException
Resolve a host name.

Returns the IP address corresponding to HostName . Resolves the host name HostName and sets HostAddress to the IP Address of the host corresponding to HostName .

IPWorksException

addIpinfoEventListener

public void addIpinfoEventListener(ipworks.IpinfoEventListener l)
                            throws java.util.TooManyListenersException
java.util.TooManyListenersException

removeIpinfoEventListener

public void removeIpinfoEventListener(ipworks.IpinfoEventListener l)

IP*Works! V8

Copyright (c) 2007 /n software inc. - All rights reserved.