IP*Works! V9

ipworks
Class Ipinfo

java.lang.Object
  extended by 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 or HostAddress 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()
          Creates an instance of Ipinfo Bean.
Ipinfo(java.lang.String runtimeLicense)
          Creates an instance of Ipinfo Bean with specified run-time license.
 
Method Summary
 void addIpinfoEventListener(IpinfoEventListener l)
           
 java.lang.String config(java.lang.String configurationString)
          Sets or retrieves a configuration 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 address of the DNS Server.
 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 the 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 completion.
 int getRequestId()
          The handle of the last request.
 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 local computer is acting as an ARP proxy.
 boolean isDNSEnabled()
          Shows whether DNS is enabled on the local computer.
 boolean isRoutingEnabled()
          Shows whether routing is enabled on the local computer.
 void removeIpinfoEventListener(IpinfoEventListener l)
           
 void reset()
          Resets the bean, stopping all pending requests and refreshing network information.
 java.lang.String resolveAddress(java.lang.String hostAddress)
          Resolves an IP address.
 java.lang.String resolveName(java.lang.String hostName)
          Resolves 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 completion.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Ipinfo

public Ipinfo()
Creates an instance of Ipinfo Bean.


Ipinfo

public Ipinfo(java.lang.String runtimeLicense)
Creates an instance of Ipinfo Bean with specified run-time license.

Method Detail

getAdapterCount

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

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


getAdapterDescription

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

This property contains the description of the adapter identified by AdapterIndex , as returned by the system.

NOTE: This functionality is only available in Windows.


getAdapterDeviceIndex

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

This property contains the system index of the adapter identified by AdapterIndex , as returned by the system.


isAdapterDHCPEnabled

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

This property indicates 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 .

This property contains 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 .

This property contains 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 this property is 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.


setAdapterIndex

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

When this property is 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.

Throws:
IPWorksException

getAdapterIPAddress

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

This property contains the IP address of the adapter identified by AdapterIndex , as returned by the system.


getAdapterLeaseExpires

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

This property contains 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 .

This property contains 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 .

This property contains the name of the adapter identified by AdapterIndex , as returned by the system.


getAdapterOtherIPAddresses

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

This property contains 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 .

This property contains the physical address of the adapter identified by AdapterIndex , as returned from the system.

This property is not supported in MacOS or iOS.


getAdapterPrimaryWINSServer

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

This property contains the primary WINS server of the adapter identified by AdapterIndex , as returned by 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 .

This property contains the secondary WINS server of the adapter identified by AdapterIndex , as returned by the system.

NOTE: This functionality is only available in Windows.


getAdapterSubnetMask

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

This property contains the subnet of the adapter identified by AdapterIndex , as returned by the system.


getAdapterType

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

This property contains the type of adapter identified by AdapterIndex , as returned by the system.

Possible values include:

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

Possible values include (Unix OS):

UP
Interface is up
BROADCAST
Broadcast address valid
DEBUG
Turn on debugging
LOOPBACK
Interface is a loopback device
POINTOPOINT
Interface is a point-to-point link
RUNNING
Resources allocated
NOARP
No address resolution protocol
PROMISC
Receive all packets
NOTRAILERS
Avoid use of trailers
ALLMULTI
Receive all multicast packets
MASTER
Master of a load balancer
SLAVE
Slave of a load balancer
MULTICAST
Supports multicast
PORTSEL
Can set media type
AUTOMEDIA
Auto media select active
DYNAMIC
Dialup device with dynamic addresses


isAdapterUsesWINS

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

This property indicates 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 local computer is acting as an ARP proxy.

This property indicates whether the local computer is acting as an ARP proxy. If true, the local computer will act as an ARP proxy, and will respond to ARP requests with its own hardware address.

NOTE: This functionality is only available in Windows.


getDHCPScope

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

This property contains a range of IP addresses which the Dynamic Host Configuration Protocol (DHCP) server can lease to clients.

NOTE: This functionality is only available in Windows.


isDNSEnabled

public boolean isDNSEnabled()
Shows whether DNS is enabled on the local computer.

This property indicates whether DNS is enabled on the local computer. 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 address of the DNS Server.

The bean attempts to find the default DNS server for the machine where it is installed, and provide it in this property.

If the bean cannot determine the default DNS server address, this property value will be an empty string.

NOTE: This functionality is only available in Windows.


getDomainName

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

This property contains the domain name to 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.

This property contains 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.

This property contains 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 

Throws:
IPWorksException

getHostAliases

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

This 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).

This property contains the domain name of the host whose IP address is specified by HostAddress .

If this property 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).

This property contains the domain name of the host whose IP address is specified by HostAddress .

If this property 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 

Throws:
IPWorksException

getLocalHost

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

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


getNodeType

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

This property contains 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).

This 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.

This property contains 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 completion.

This 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.

NOTE: This functionality is only available in Windows.


setPendingRequests

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

This 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.

NOTE: This functionality is only available in Windows.

Throws:
IPWorksException

getRequestId

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

This property contains the handle of the last request.

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

NOTE: This functionality is only available in Windows.


isRoutingEnabled

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

This property indicates whether routing is enabled on the local computer.

NOTE: This functionality is only available in Windows.


config

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

Config is a generic method available in every bean. It is used to set and retrieve configuration settings for 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.

The bean accepts one or more of the following configuration settings . 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.

IPInfo Configuration Settings

UseOldApi
If set the bean will use the old API to get Adapter information
The bean uses new system calls to obtain IPv6 as well as IPv4 adapter information. Some of the new System calls are not supported on the XP Windows operating system however. Set this config to false to use the old System calls when retrieving adapter information.

NOTE: This functionality is only available in Windows.

NOTE: This config should only be needed when using the XP operating system.

ARPAddress
Specifies the IP Address of the interface to be used for the GetMAC method
By default, when GetMAC is called the bean will attempt the address resolution from the first adapter listed by the system. In multi-homed machines it may be necessary to specify the IP address of the interface to be used as the source of the address resolution request. Set this setting to the local IP address of the adapter to be used when making this request.

Base Configuration Settings

GUIAvailable
Tells the bean whether or not a message loop is available for processing events
In a GUI-based application, long-running blocking operations may cause the application to stop responding to input until the operation returns. The bean will attempt to discover whether or not the application has a message loop and, if one is discovered, it will process events in that message loop during any such blocking operation.In some non-GUI applications an invalid message loop may be discovered that will result in errant behavior. In these cases, setting GuiAvailable to false will ensure that the bean does not attempt to process external events.

Throws:
IPWorksException

DHCPRelease

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

This method 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.

Throws:
IPWorksException

DHCPRenew

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

This method 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.

Throws:
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.

Throws:
IPWorksException

getMAC

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

This method returns the unique Media Access Control (MAC) address of the network interface at IPAddress .

NOTE: This functionality is only available in Windows.

Throws:
IPWorksException

reset

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

This method 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.

Throws:
IPWorksException

resolveAddress

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

This method 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)

 String hostname = IPInfoControl.ResolveAddress("10.0.1.10"); 

Throws:
IPWorksException

resolveName

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

This method resolves the host name HostName and sets HostAddress to the IP Address of the host corresponding to HostName .

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

Example (Resolve a Name)

 String ipaddress = IPInfoControl.ResolveName("MyHostName"); 

Throws:
IPWorksException

addIpinfoEventListener

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

removeIpinfoEventListener

public void removeIpinfoEventListener(IpinfoEventListener l)

IP*Works! V9

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