IP*Works!

ipworks
Class Ipinfo

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

public class Ipinfo
extends java.lang.Object

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

The IPInfo control operates asynchronously. Requests are posted to the control 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(IpinfoEventListener l)
           
 void fireError(int errorCode, java.lang.String description)
          Information about errors during data delivery.
 void fireRequestComplete(int requestId, int statusCode, java.lang.String description)
          Fired after an asynchronous request completes.
 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 getOtherAddresses()
          Other addresses for the host identified by HostName (for multihomed hosts).
 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 .
 void removeIpinfoEventListener(IpinfoEventListener l)
           
 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 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

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.


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.


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.


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.


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() Winsock call, or if the user has assigned an IP address, the value of that address.


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


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.


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.


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.


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.


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.


fireError

public void fireError(int errorCode,
                      java.lang.String description)
Information about errors during data delivery. (Called internally to dispatch the event.)
See Also:
IpinfoErrorEvent

fireRequestComplete

public void fireRequestComplete(int requestId,
                                int statusCode,
                                java.lang.String description)
Fired after an asynchronous request completes. (Called internally to dispatch the event.)
See Also:
IpinfoRequestCompleteEvent

resolveAddress

public java.lang.String resolveAddress(java.lang.String hostAddress)
                                throws IPWorksException
Resolve an IP address. Returns the name of the host corresponding to HostAddress .

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


resolveName

public java.lang.String resolveName(java.lang.String hostName)
                             throws IPWorksException
Resolve a host name. Returns the IP address corresponding to HostName .

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


addIpinfoEventListener

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

removeIpinfoEventListener

public void removeIpinfoEventListener(IpinfoEventListener l)

IP*Works!

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