Struct ipworks::IPInfo
Properties Methods Events Config Settings Errors
The IPInfo struct is used to resolve host names to host addresses and vice versa using an asynchronous DNS. The struct provides access to other Transmission Control Protocol (TCP)/IP database functions as well.
Syntax
ipworks::IPInfo
Remarks
The IPInfo struct operates asynchronously. Requests are posted to the struct by setting a property like host_name or host_address and then waiting for the on_request_complete event. The request_id property identifies the request.
Up to 100 simultaneous requests can be queued at any moment. pending_requests shows the number of pending requests and also may be used to adjust the size of the queue (by dumping a number of the pending requests).
Object Lifetime
The new() method returns a mutable reference to a struct instance. The object itself is kept in the global list maintained by IPWorks. Due to this, the IPInfo struct cannot be disposed of automatically. Please, call the dispose(&mut self) method of IPInfo when you have finished using the instance.
Property List
The following is the full list of the properties of the struct with short descriptions. Click on the links for further details.
| adapter_broadcast_address | This property includes the broadcast address of the adapter. |
| adapter_count | This property includes the number of adapters in the system. |
| adapter_description | This property includes the description of the adapter identified by AdapterIndex . |
| adapter_device_index | This property includes the system index of the adapter identified by AdapterIndex . |
| adapter_dhcp_enabled | This property shows whether or not the adapter identified by AdapterIndex has been DHCP enabled. |
| adapter_dhcp_server | This property includes the DHCP server of the adapter identified by AdapterIndex . |
| adapter_dns_servers | This property includes the DNS server list for the adapter identified by AdapterIndex . |
| adapter_gateway | This property includes the default gateway of the adapter identified by AdapterIndex . |
| adapter_index | This property sets the current adapter. |
| adapter_ip_address | This property includes the IP address of the adapter identified by AdapterIndex . |
| adapter_ipv6_address | This is the IPv6 address of the adapter identified by AdapterIndex . |
| adapter_ipv6_link_local_address | This property includes the IPv6 link to the local address of the adapter identified by AdapterIndex . |
| adapter_lease_expires | This property includes the expiration date and time of the lease obtained by the adapter identified by AdapterIndex . |
| adapter_lease_obtained | This property includes the date and time when the current lease was obtained by the adapter identified by AdapterIndex . |
| adapter_name | This property includes the name of the adapter identified by AdapterIndex . |
| adapter_other_ip_addresses | This property includes the other IP addresses leased by the adapter specified by AdapterIndex , if any. |
| adapter_physical_address | This property includes the physical address of the adapter identified by AdapterIndex . |
| adapter_primary_wins_server | This property includes the primary WINS server of the adapter identified by AdapterIndex . |
| adapter_secondary_wins_server | This property includes the secondary WINS server of the adapter identified by AdapterIndex . |
| adapter_status | This property returns the current status of the adapter. |
| adapter_subnet_mask | This property includes the subnet of the adapter identified by AdapterIndex . |
| adapter_type | This property includes the type of adapter identified by AdapterIndex . |
| adapter_uses_wins | This property includes the shows whether or not the adapter identified by AdapterIndex uses WINS. |
| adapter_zone_id | This property includes the zone Id of the adapter identified by AdapterIndex . |
| arp_proxy | This property shows whether the local computer is acting as an Address Resolution Protocol (ARP) proxy. |
| dhcp_scope | This property includes the DHCP scope of the DHCP server. |
| dns_enabled | This property shows whether DNS is enabled on the local computer. |
| dns_server | This property includes the address of the DNS server. |
| domain_name | This property includes the current network domain on which the system resides. |
| host_address | This property includes an internet address in dotted format. When set, it initiates a search for the corresponding host name. |
| host_aliases | This property includes other names corresponding to the host with the name HostName. |
| host_name | This property includes the domain name of an internet host. When set, it initiates a search for the corresponding address(es). |
| local_host | This property includes the name of the local host. |
| node_type | This property includes the type of node for the system. |
| other_addresses | This property includes other addresses for the host identified by HostName (for multihomed hosts). |
| other_dns_servers | This property includes other DNS servers configured for the host machine. |
| pending_requests | This property includes the number of requests awaiting completion. |
| request_id | This property includes the handle of the last request. |
| routing_enabled | This property shows whether routing is enabled on the local computer. |
| service_aliases | This property includes other names by which the service specified by ServiceName / ServicePort is known. |
| service_name | This property includes the name for a service. When set, it initiates a search for the corresponding port number and protocol. |
| service_port | This property includes a port number for a service. When set, it initiates a search for the corresponding service name and protocol. |
| service_protocol | This property includes the protocol of the service specified by ServiceName / ServicePort . |
Method List
The following is the full list of the methods of the struct with short descriptions. Click on the links for further details.
| config | Sets or retrieves a configuration setting. |
| dhcp_release | This method releases the IP address of the current adapter specified by AdapterIndex . |
| dhcp_renew | This method renews the IP address of the current adapter specified by AdapterIndex . |
| display_dns_cache | This method displays cached DNS entries. |
| do_events | This method processes events from the internal message queue. |
| flush_dns_cache | This method flushes the DNS cache. |
| get_mac | This method returns the MAC address of the network interface at IPAddress . |
| reset | This method resets the struct, stopping all pending requests and refreshing network information. |
| resolve_address | This method resolves an IP address. |
| resolve_name | This method resolves a host name. |
Event List
The following is the full list of the events fired by the struct with short descriptions. Click on the links for further details.
| on_dns_cache_entry | This event fires once for each cached DNS entry. |
| on_error | Fired when information is available about errors during data delivery. |
| on_request_complete | This event is fired after an asynchronous request completes. |
Config Settings
The following is a list of config settings for the struct with short descriptions. Click on the links for further details.
| AdapterDADState | Specifies the Duplicate Address Detection state of the IP address of the adapter specified by AdapterIndex. |
| AdapterIPv6DADState | Specifies the Duplicate Address Detection state of the IPv6 address of the adapter specified by AdapterIndex. |
| AdapterOtherDADStates | Specifies the Duplicate Address Detection states of the IP addresses leased by the adapter specified by AdapterIndex, if any. |
| ARPAddress | Specifies the IP Address of the interface to be used for the GetMAC method. |
| UseOldApi | If set the struct will use the old API to get Adapter information. |
| BuildInfo | Information about the product's build. |
| CodePage | The system code page used for Unicode to Multibyte translations. |
| LicenseInfo | Information about the current license. |
| MaskSensitiveData | Whether sensitive data is masked in log messages. |
| UseInternalSecurityAPI | Whether or not to use the system security libraries or an internal implementation. |
adapter_broadcast_address property (IPInfo Struct)
This property includes the broadcast address of the adapter.
Syntax
fn adapter_broadcast_address(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains the broadcast address of the adapter specified by adapter_index.
This property is read-only.
Data Type
String
adapter_count property (IPInfo Struct)
This property includes the number of adapters in the system.
Syntax
fn adapter_count(&self ) -> Result<i32, IPWorksError>
Default Value
0
Remarks
This property shows how many adapters are installed in the system. You can set the adapter_index from 0 to the adapter_count and then examine the adapter properties, such as adapter_description, adapter_name, and adapter_ip_address, to retrieve information about each adapter.
This property is read-only.
Data Type
i32
adapter_description property (IPInfo Struct)
This property includes the description of the adapter identified by AdapterIndex .
Syntax
fn adapter_description(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains the description of the adapter identified by adapter_index, as returned by the system.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
String
adapter_device_index property (IPInfo Struct)
This property includes the system index of the adapter identified by AdapterIndex .
Syntax
fn adapter_device_index(&self ) -> Result<i32, IPWorksError>
Default Value
0
Remarks
This property contains the system index of the adapter identified by adapter_index, as returned by the system.
This property is read-only.
Data Type
i32
adapter_dhcp_enabled property (IPInfo Struct)
This property shows whether or not the adapter identified by AdapterIndex has been DHCP enabled.
Syntax
fn adapter_dhcp_enabled(&self ) -> Result<bool, IPWorksError>
Default Value
false
Remarks
This property indicates whether or not the adapter identified by adapter_index has been DHCP enabled. The Dynamic Host Configuration Protocol (DHCP) is used to automatically assign IP addresses on a network.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
bool
adapter_dhcp_server property (IPInfo Struct)
This property includes the DHCP server of the adapter identified by AdapterIndex .
Syntax
fn adapter_dhcp_server(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains the DHCP server of the adapter identified by adapter_index. The Dynamic Host Configuration Protocol (DHCP) is used to automatically assign IP addresses on a network.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
String
adapter_dns_servers property (IPInfo Struct)
This property includes the DNS server list for the adapter identified by AdapterIndex .
Syntax
fn adapter_dns_servers(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains a space-separated list of DNS servers for the adapter specified by adapter_index, as returned by the system.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
String
adapter_gateway property (IPInfo Struct)
This property includes the default gateway of the adapter identified by AdapterIndex .
Syntax
fn adapter_gateway(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains the default gateway of the adapter identified by adapter_index, as returned by the system.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
String
adapter_index property (IPInfo Struct)
This property sets the current adapter.
Syntax
fn adapter_index(&self ) -> Result<i32, IPWorksError>
fn set_adapter_index(&self, value : i32) -> Option<IPWorksError>
Default Value
0
Remarks
When this property is set, the struct asks the system for information on the adapter with an index of adapter_index. If the system has information, the adapter properties will be populated with the data returned.
adapter_count is the number of adapters located in the system.
Data Type
i32
adapter_ip_address property (IPInfo Struct)
This property includes the IP address of the adapter identified by AdapterIndex .
Syntax
fn adapter_ip_address(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains the IP address of the adapter identified by adapter_index, as returned by the system.
This property is read-only.
Data Type
String
adapter_ipv6_address property (IPInfo Struct)
This is the IPv6 address of the adapter identified by AdapterIndex .
Syntax
fn adapter_ipv6_address(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This is the IPv6 address of the adapter identified by adapter_index, as returned by the system.
NOTE: This functionality is only available in Windows.
NOTE: This functionality is available only on XP or newer OS versions.
This property is read-only.
Data Type
String
adapter_ipv6_link_local_address property (IPInfo Struct)
This property includes the IPv6 link to the local address of the adapter identified by AdapterIndex .
Syntax
fn adapter_ipv6_link_local_address(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property includes the IPv6 link to the local address of the adapter identified by adapter_index, as returned by the system.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
String
adapter_lease_expires property (IPInfo Struct)
This property includes the expiration date and time of the lease obtained by the adapter identified by AdapterIndex .
Syntax
fn adapter_lease_expires(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains the expiration date and time of the lease obtained by the adapter identified by adapter_index, as returned by the system.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
String
adapter_lease_obtained property (IPInfo Struct)
This property includes the date and time when the current lease was obtained by the adapter identified by AdapterIndex .
Syntax
fn adapter_lease_obtained(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains the date and time when the current lease was obtained by the adapter identified by adapter_index, as returned by the system.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
String
adapter_name property (IPInfo Struct)
This property includes the name of the adapter identified by AdapterIndex .
Syntax
fn adapter_name(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains the name of the adapter identified by adapter_index, as returned by the system.
This property is read-only.
Data Type
String
adapter_other_ip_addresses property (IPInfo Struct)
This property includes the other IP addresses leased by the adapter specified by AdapterIndex , if any.
Syntax
fn adapter_other_ip_addresses(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains a space-separated list of any other IP addresses leased by the adapter specified by adapter_index, if any.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
String
adapter_physical_address property (IPInfo Struct)
This property includes the physical address of the adapter identified by AdapterIndex .
Syntax
fn adapter_physical_address(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains the physical address of the adapter identified by adapter_index, as returned from the system.
NOTE: This property is not supported in MacOS or iOS.
This property is read-only.
Data Type
String
adapter_primary_wins_server property (IPInfo Struct)
This property includes the primary WINS server of the adapter identified by AdapterIndex .
Syntax
fn adapter_primary_wins_server(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains the primary WINS server of the adapter identified by adapter_index, as returned by the system.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
String
adapter_secondary_wins_server property (IPInfo Struct)
This property includes the secondary WINS server of the adapter identified by AdapterIndex .
Syntax
fn adapter_secondary_wins_server(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains the secondary WINS server of the adapter identified by adapter_index, as returned by the system.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
String
adapter_status property (IPInfo Struct)
This property returns the current status of the adapter.
Syntax
fn adapter_status(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property holds the current status of the adapter specified by adapter_index.
Possible values are as follows:
- "Up"
- "Down"
- "Testing"
- "Unknown"
- "Dormant"
- "NotPresent"
- "LowerLayerDown"
NOTE: This property is not applicable when UseOldApi is True.
This property is read-only.
Data Type
String
adapter_subnet_mask property (IPInfo Struct)
This property includes the subnet of the adapter identified by AdapterIndex .
Syntax
fn adapter_subnet_mask(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains the subnet of the adapter identified by adapter_index, as returned by the system.
This property is read-only.
Data Type
String
adapter_type property (IPInfo Struct)
This property includes the type of adapter identified by AdapterIndex .
Syntax
fn adapter_type(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains the type of adapter identified by adapter_index, as returned by the system.
Possible values include the following:
| 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 the following (Unix OS):
| UP | Interface is up |
| BROADCAST | Broadcast address is 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 |
This property is read-only.
Data Type
String
adapter_uses_wins property (IPInfo Struct)
This property includes the shows whether or not the adapter identified by AdapterIndex uses WINS.
Syntax
fn adapter_uses_wins(&self ) -> Result<bool, IPWorksError>
Default Value
false
Remarks
This property indicates whether or not the adapter identified by adapter_index uses WINS. Windows Internet Name Service (WINS) is a name resolution service that is used to resolve Windows network hostnames to IP addresses.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
bool
adapter_zone_id property (IPInfo Struct)
This property includes the zone Id of the adapter identified by AdapterIndex .
Syntax
fn adapter_zone_id(&self ) -> Result<i32, IPWorksError>
Default Value
0
Remarks
Also known as a scope Id, the zone Id specifies the IPv6 zone to which the current adapter belongs. The values of the zone Id are defined relative to the sending host. When using an IPv6-enabled XP operating system, the zone Id of the sender MUST be appended after a "%" to the desired IPv6 address. This is an integer value on Windows systems.
NOTE: This functionality is only available in Windows.
NOTE: This functionality is only available on XP or newer OS versions.
This property is read-only.
Data Type
i32
arp_proxy property (IPInfo Struct)
This property shows whether the local computer is acting as an Address Resolution Protocol (ARP) proxy.
Syntax
fn arp_proxy(&self ) -> Result<bool, IPWorksError>
Default Value
false
Remarks
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.
This property is read-only.
Data Type
bool
dhcp_scope property (IPInfo Struct)
This property includes the DHCP scope of the DHCP server.
Syntax
fn dhcp_scope(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains a range of IP addresses that the Dynamic Host Configuration Protocol (DHCP) server can lease to clients.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
String
dns_enabled property (IPInfo Struct)
This property shows whether DNS is enabled on the local computer.
Syntax
fn dns_enabled(&self ) -> Result<bool, IPWorksError>
Default Value
false
Remarks
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.
This property is read-only.
Data Type
bool
dns_server property (IPInfo Struct)
This property includes the address of the DNS server.
Syntax
fn dns_server(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
The struct attempts to find the default DNS server for the machine where it is installed, and to provide it in this property.
If the struct cannot determine the default DNS server address, this property value will be an empty string.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
String
domain_name property (IPInfo Struct)
This property includes the current network domain on which the system resides.
Syntax
fn domain_name(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains the domain name to which the system is joined.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
String
host_address property (IPInfo Struct)
This property includes an internet address in dotted format. When set, it initiates a search for the corresponding host name.
Syntax
fn host_address(&self ) -> Result<String, IPWorksError>
fn set_host_address(&self, value : &str) -> Option<IPWorksError> fn set_host_address_ref(&self, value : &String) -> Option<IPWorksError>
Default Value
""
Remarks
This property contains the IP address (in internet dotted format aaa.bbb.ccc.ddd) of the host whose domain name is specified by host_name
If host_address is set to an IP address, a search is initiated for the corresponding host names(s).
The on_request_complete event is fired when the search is complete. The request_id 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
Data Type
String
host_aliases property (IPInfo Struct)
This property includes other names corresponding to the host with the name HostName.
Syntax
fn host_aliases(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains a list of alternate names for the host specified by host_name and host_address separated by spaces.
This property is read-only.
Data Type
String
host_name property (IPInfo Struct)
This property includes the domain name of an internet host. When set, it initiates a search for the corresponding address(es).
Syntax
fn host_name(&self ) -> Result<String, IPWorksError>
fn set_host_name(&self, value : &str) -> Option<IPWorksError> fn set_host_name_ref(&self, value : &String) -> Option<IPWorksError>
Default Value
""
Remarks
This property contains the domain name of the host whose IP address is specified by host_address.
If this property is set to a domain name, a search is initiated for the corresponding host address(s).
The on_request_complete event is fired when the search is complete. The request_id property identifies the pending request.
Example. Resolve a Name:
IPInfoControl.HostName = "MyHostName"
While IPInfoControl.PendingRequests > 0
IPInfoControl.DoEvents()
End While
ResolvedAddress = IPInfoControl.HostAddress
Data Type
String
local_host property (IPInfo Struct)
This property includes the name of the local host.
Syntax
fn local_host(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains the name of the local host as obtained by the gethostname() system call. If the user has assigned an IP address, it will contain the value of that address.
This property is read-only.
Data Type
String
node_type property (IPInfo Struct)
This property includes the type of node for the system.
Syntax
fn node_type(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains the type of node for the system. Possible values include BROADCAST, PEERTOPEER, MIXED, and HYBRID.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
String
other_addresses property (IPInfo Struct)
This property includes other addresses for the host identified by HostName (for multihomed hosts).
Syntax
fn other_addresses(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains a list of alternate addresses for the host specified by host_name and host_address separated by spaces. Most hosts have only one IP interface. This property is useful when querying multihomed hosts (hosts with more than one interface).
This property is read-only.
Data Type
String
other_dns_servers property (IPInfo Struct)
This property includes other DNS servers configured for the host machine.
Syntax
fn other_dns_servers(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains a space-separated list of DNS servers configured for the host machine. NOTE: The primary server is provided in the dns_server property.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
String
pending_requests property (IPInfo Struct)
This property includes the number of requests awaiting completion.
Syntax
fn pending_requests(&self ) -> Result<i32, IPWorksError>
fn set_pending_requests(&self, value : i32) -> Option<IPWorksError>
Default Value
0
Remarks
This property serves two functions: it shows the number of requests that are pending completion, and it also can be used to adjust the size of the queue by dumping part or all of the pending requests.
To cancel all the pending requests at any moment, simply set pending_requests to 0.
NOTE: This functionality is only available in Windows.
Data Type
i32
request_id property (IPInfo Struct)
This property includes the handle of the last request.
Syntax
fn request_id(&self ) -> Result<i32, IPWorksError>
Default Value
0
Remarks
This property contains the handle of the last request.
This handle can be used later to identify the request when the on_request_complete event is fired.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
i32
routing_enabled property (IPInfo Struct)
This property shows whether routing is enabled on the local computer.
Syntax
fn routing_enabled(&self ) -> Result<bool, IPWorksError>
Default Value
false
Remarks
This property indicates whether routing is enabled on the local computer.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
bool
service_aliases property (IPInfo Struct)
This property includes other names by which the service specified by ServiceName / ServicePort is known.
Syntax
fn service_aliases(&self ) -> Result<String, IPWorksError>
Default Value
""
Remarks
This property contains a list of alternate service names separated by spaces. In most cases, this list is empty.
NOTE: This functionality is only available in Windows.
This property is read-only.
Data Type
String
service_name property (IPInfo Struct)
This property includes the name for a service. When set, it initiates a search for the corresponding port number and protocol.
Syntax
fn service_name(&self ) -> Result<String, IPWorksError>
fn set_service_name(&self, value : &str) -> Option<IPWorksError> fn set_service_name_ref(&self, value : &String) -> Option<IPWorksError>
Default Value
""
Remarks
This property contains the name of the specified service located at service_port.
If this property is set to a service name, a search is initiated for the corresponding service_port and other information related to the service (if any).
The on_request_complete event is fired when the search is complete. request_id identifies the pending request.
NOTE: This functionality is only available in Windows.
Data Type
String
service_port property (IPInfo Struct)
This property includes a port number for a service. When set, it initiates a search for the corresponding service name and protocol.
Syntax
fn service_port(&self ) -> Result<i32, IPWorksError>
fn set_service_port(&self, value : i32) -> Option<IPWorksError>
Default Value
0
Remarks
This property contains the port number for the service specified by service_name.
If this property is set to a port number, a search is initiated for the service_name and other information related to the service (if any).
The on_request_complete event is fired when the search is complete. request_id identifies the pending request.
NOTE: This functionality is only available in Windows.
Data Type
i32
service_protocol property (IPInfo Struct)
This property includes the protocol of the service specified by ServiceName / ServicePort .
Syntax
fn service_protocol(&self ) -> Result<String, IPWorksError>
fn set_service_protocol(&self, value : &str) -> Option<IPWorksError> fn set_service_protocol_ref(&self, value : &String) -> Option<IPWorksError>
Default Value
""
Remarks
This property contains the protocol for the service specified by service_name.
Setting this property to a particular protocol name (e.g., 'udp' or 'tcp') will force a search for a service for that protocol only. If this property is set to "" (empty string), then the first entry for the service will be returned and this property will be set to the corresponding protocol.
NOTE: This functionality is only available in Windows.
Data Type
String
config method (IPInfo Struct)
Sets or retrieves a configuration setting.
Syntax
fn config(&self, configuration_string : &str) -> Result<String, IPWorksError>
Remarks
config is a generic method available in every struct. It is used to set and retrieve configuration settings for the struct.
These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the struct, 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.
dhcp_release method (IPInfo Struct)
This method releases the IP address of the current adapter specified by AdapterIndex .
Syntax
fn dhcp_release(&self) -> Result<(), IPWorksError>
Remarks
This method releases the IP address of the current adapter specified by adapter_index. If adapter_dhcp_enabled is True, the lease of the IP address assigned to the current adapter specified by adapter_index is released.
NOTE: This functionality is only available in Windows.
dhcp_renew method (IPInfo Struct)
This method renews the IP address of the current adapter specified by AdapterIndex .
Syntax
fn dhcp_renew(&self) -> Result<(), IPWorksError>
Remarks
This method renews the IP address of the current adapter specified by AdapterIndex. If adapter_dhcp_enabled is True, the lease of the IP address assigned to the current adapter specified by adapter_index is renewed.
NOTE: This functionality is only available in Windows.
display_dns_cache method (IPInfo Struct)
This method displays cached DNS entries.
Syntax
fn display_dns_cache(&self) -> Result<String, IPWorksError>
Remarks
This method displays details of the locally cached DNS records.
This method will return a string with information about the DNS cache. In addition the on_dns_cache_entry event will fire once per cached entry.
The returned value is in the following format:
docs.google.com ---------------------------------------- Record Name . . . . . : docs.google.com Record Type . . . . . : 1(A) Time To Live . . . . : 48 Data Length . . . . . : 4 Section . . . . . . . : Answer A Record . . . . . . : 216.58.218.238
NOTE: This functionality is only available in Windows.
do_events method (IPInfo Struct)
This method processes events from the internal message queue.
Syntax
fn do_events(&self) -> Result<(), IPWorksError>
Remarks
When do_events is called, the struct processes any available events. If no events are available, it waits for a preset period of time, and then returns.
flush_dns_cache method (IPInfo Struct)
This method flushes the DNS cache.
Syntax
fn flush_dns_cache(&self) -> Result<bool, IPWorksError>
Remarks
This method flushes the DNS cache for the system.
NOTE: This functionality is only available in Windows.
get_mac method (IPInfo Struct)
This method returns the MAC address of the network interface at IPAddress .
Syntax
fn get_mac(&self, ip_address : &str) -> Result<String, IPWorksError>
Remarks
This method returns the unique Media Access Control (MAC) address of the network interface at ip_address.
NOTE: This functionality is only available in Windows.
reset method (IPInfo Struct)
This method resets the struct, stopping all pending requests and refreshing network information.
Syntax
fn reset(&self) -> Result<(), IPWorksError>
Remarks
This method resets the struct, stopping all pending requests and refreshing network information. If the network configuration has changed, call this method to retrieve the latest information.
resolve_address method (IPInfo Struct)
This method resolves an IP address.
Syntax
fn resolve_address(&self, host_address : &str) -> Result<String, IPWorksError>
Remarks
This method resolves the IP address host_address and sets host_name to the name of the host corresponding to host_address.
Calling this method is equivalent to setting the host_address property to host_address.
Example. Resolve an Address:
IPInfoControl.ResolveAddress ("10.0.1.10")
While (IPInfoControl.PendingRequests > 0)
IPInfoControl.DoEvents
Wend
Debug.Print IPInfoControl.HostName
resolve_name method (IPInfo Struct)
This method resolves a host name.
Syntax
fn resolve_name(&self, host_name : &str) -> Result<String, IPWorksError>
Remarks
This method resolves the host name host_name and sets host_address to the IP address of the host corresponding to host_name.
Calling this method is equivalent to setting the host_name property to host_name.
Example. Resolve a Name:
IPInfoControl.ResolveName ("MyHostName")
While (IPInfoControl.PendingRequests > 0)
IPInfoControl.DoEvents
Wend
Debug.Print IPInfoControl.HostAddress
on_dns_cache_entry event (IPInfo Struct)
This event fires once for each cached DNS entry.
Syntax
// IPInfoDNSCacheEntryEventArgs carries the IPInfo DNSCacheEntry event's parameters.
pub struct IPInfoDNSCacheEntryEventArgs {
fn record_name(&self) -> &String
fn record_type(&self) -> i32
fn time_to_live(&self) -> i32
fn data_length(&self) -> i32
fn section(&self) -> &String
fn record_value(&self) -> &String
fn record_info(&self) -> &String
}
// IPInfoDNSCacheEntryEvent defines the signature of the IPInfo DNSCacheEntry event's handler function.
pub trait IPInfoDNSCacheEntryEvent {
fn on_dns_cache_entry(&self, sender : IPInfo, e : &mut IPInfoDNSCacheEntryEventArgs);
}
impl <'a> IPInfo<'a> {
pub fn on_dns_cache_entry(&self) -> &'a dyn IPInfoDNSCacheEntryEvent;
pub fn set_on_dns_cache_entry(&mut self, value : &'a dyn IPInfoDNSCacheEntryEvent);
...
}
Remarks
This event fires once for each entry in the local DNS cache when display_dns_cache is called.
record_name is the host name to which the record applies.
record_type is the type of response. For instance 1 is an A record.
time_to_live is the time in seconds after which the cached entry expires.
data_length is the length of the data in bytes. For instance, if the RecordType is A and an IPv4 address is cached, its DataLength would be 4. CNAME and PTR records will contain the length of the address in memory where the value is held.
section is the section of the DNS response from which the record is taken. Most commonly, this is the "Answer" section.
record_value is the actual value that is cached. For instance this may be an IP address for A records.
record_info is a text representation of the other parameters. This is suitable for use in a log file or to display.
on_error event (IPInfo Struct)
Fired when information is available about errors during data delivery.
Syntax
// IPInfoErrorEventArgs carries the IPInfo Error event's parameters.
pub struct IPInfoErrorEventArgs {
fn error_code(&self) -> i32
fn description(&self) -> &String
}
// IPInfoErrorEvent defines the signature of the IPInfo Error event's handler function.
pub trait IPInfoErrorEvent {
fn on_error(&self, sender : IPInfo, e : &mut IPInfoErrorEventArgs);
}
impl <'a> IPInfo<'a> {
pub fn on_error(&self) -> &'a dyn IPInfoErrorEvent;
pub fn set_on_error(&mut self, value : &'a dyn IPInfoErrorEvent);
...
}
Remarks
The on_error event is fired in case of exceptional conditions during message processing. Normally the struct fails with an error.
The error_code parameter contains an error code, and the description parameter contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the Error Codes section.
on_request_complete event (IPInfo Struct)
This event is fired after an asynchronous request completes.
Syntax
// IPInfoRequestCompleteEventArgs carries the IPInfo RequestComplete event's parameters.
pub struct IPInfoRequestCompleteEventArgs {
fn request_id(&self) -> i32
fn status_code(&self) -> i32
fn description(&self) -> &String
}
// IPInfoRequestCompleteEvent defines the signature of the IPInfo RequestComplete event's handler function.
pub trait IPInfoRequestCompleteEvent {
fn on_request_complete(&self, sender : IPInfo, e : &mut IPInfoRequestCompleteEventArgs);
}
impl <'a> IPInfo<'a> {
pub fn on_request_complete(&self) -> &'a dyn IPInfoRequestCompleteEvent;
pub fn set_on_request_complete(&mut self, value : &'a dyn IPInfoRequestCompleteEvent);
...
}
Remarks
The request_id parameter specifies the request that just completed. The struct properties that relate to this request are completed with the returned values. For example, in the case of domain name resolution, host_name, host_address, host_aliases, and other_addresses are set to the resolved values.
If the request completed normally, status_code is 0, and description is "OK". If not, status_code has the error code returned by the system. description contains a description of this code.
Please refer to the Error Codes section for more information.
NOTE: This functionality is only available in Windows.
Config Settings (IPInfo Struct)
The struct 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 struct, access to these internal properties is provided through the config method.IPInfo Config Settings
- (Empty) - Indicates the struct was unable to get any information.
- Invalid
- Tentative
- Duplicate
- Deprecated
- Preferred
- (Empty) - Indicates the struct was unable to get any information.
- Invalid
- Tentative
- Duplicate
- Deprecated
- Preferred
- (Empty) - Indicates the struct was unable to get any information.
- Invalid
- Tentative
- Duplicate
- Deprecated
- Preferred
NOTE: This functionality is only available in Windows.
NOTE: This setting should be needed only when using the XP operating system.
Base Config Settings
The following is a list of valid code page identifiers:
| Identifier | Name |
| 037 | IBM EBCDIC - U.S./Canada |
| 437 | OEM - United States |
| 500 | IBM EBCDIC - International |
| 708 | Arabic - ASMO 708 |
| 709 | Arabic - ASMO 449+, BCON V4 |
| 710 | Arabic - Transparent Arabic |
| 720 | Arabic - Transparent ASMO |
| 737 | OEM - Greek (formerly 437G) |
| 775 | OEM - Baltic |
| 850 | OEM - Multilingual Latin I |
| 852 | OEM - Latin II |
| 855 | OEM - Cyrillic (primarily Russian) |
| 857 | OEM - Turkish |
| 858 | OEM - Multilingual Latin I + Euro symbol |
| 860 | OEM - Portuguese |
| 861 | OEM - Icelandic |
| 862 | OEM - Hebrew |
| 863 | OEM - Canadian-French |
| 864 | OEM - Arabic |
| 865 | OEM - Nordic |
| 866 | OEM - Russian |
| 869 | OEM - Modern Greek |
| 870 | IBM EBCDIC - Multilingual/ROECE (Latin-2) |
| 874 | ANSI/OEM - Thai (same as 28605, ISO 8859-15) |
| 875 | IBM EBCDIC - Modern Greek |
| 932 | ANSI/OEM - Japanese, Shift-JIS |
| 936 | ANSI/OEM - Simplified Chinese (PRC, Singapore) |
| 949 | ANSI/OEM - Korean (Unified Hangul Code) |
| 950 | ANSI/OEM - Traditional Chinese (Taiwan; Hong Kong SAR, PRC) |
| 1026 | IBM EBCDIC - Turkish (Latin-5) |
| 1047 | IBM EBCDIC - Latin 1/Open System |
| 1140 | IBM EBCDIC - U.S./Canada (037 + Euro symbol) |
| 1141 | IBM EBCDIC - Germany (20273 + Euro symbol) |
| 1142 | IBM EBCDIC - Denmark/Norway (20277 + Euro symbol) |
| 1143 | IBM EBCDIC - Finland/Sweden (20278 + Euro symbol) |
| 1144 | IBM EBCDIC - Italy (20280 + Euro symbol) |
| 1145 | IBM EBCDIC - Latin America/Spain (20284 + Euro symbol) |
| 1146 | IBM EBCDIC - United Kingdom (20285 + Euro symbol) |
| 1147 | IBM EBCDIC - France (20297 + Euro symbol) |
| 1148 | IBM EBCDIC - International (500 + Euro symbol) |
| 1149 | IBM EBCDIC - Icelandic (20871 + Euro symbol) |
| 1200 | Unicode UCS-2 Little-Endian (BMP of ISO 10646) |
| 1201 | Unicode UCS-2 Big-Endian |
| 1250 | ANSI - Central European |
| 1251 | ANSI - Cyrillic |
| 1252 | ANSI - Latin I |
| 1253 | ANSI - Greek |
| 1254 | ANSI - Turkish |
| 1255 | ANSI - Hebrew |
| 1256 | ANSI - Arabic |
| 1257 | ANSI - Baltic |
| 1258 | ANSI/OEM - Vietnamese |
| 1361 | Korean (Johab) |
| 10000 | MAC - Roman |
| 10001 | MAC - Japanese |
| 10002 | MAC - Traditional Chinese (Big5) |
| 10003 | MAC - Korean |
| 10004 | MAC - Arabic |
| 10005 | MAC - Hebrew |
| 10006 | MAC - Greek I |
| 10007 | MAC - Cyrillic |
| 10008 | MAC - Simplified Chinese (GB 2312) |
| 10010 | MAC - Romania |
| 10017 | MAC - Ukraine |
| 10021 | MAC - Thai |
| 10029 | MAC - Latin II |
| 10079 | MAC - Icelandic |
| 10081 | MAC - Turkish |
| 10082 | MAC - Croatia |
| 12000 | Unicode UCS-4 Little-Endian |
| 12001 | Unicode UCS-4 Big-Endian |
| 20000 | CNS - Taiwan |
| 20001 | TCA - Taiwan |
| 20002 | Eten - Taiwan |
| 20003 | IBM5550 - Taiwan |
| 20004 | TeleText - Taiwan |
| 20005 | Wang - Taiwan |
| 20105 | IA5 IRV International Alphabet No. 5 (7-bit) |
| 20106 | IA5 German (7-bit) |
| 20107 | IA5 Swedish (7-bit) |
| 20108 | IA5 Norwegian (7-bit) |
| 20127 | US-ASCII (7-bit) |
| 20261 | T.61 |
| 20269 | ISO 6937 Non-Spacing Accent |
| 20273 | IBM EBCDIC - Germany |
| 20277 | IBM EBCDIC - Denmark/Norway |
| 20278 | IBM EBCDIC - Finland/Sweden |
| 20280 | IBM EBCDIC - Italy |
| 20284 | IBM EBCDIC - Latin America/Spain |
| 20285 | IBM EBCDIC - United Kingdom |
| 20290 | IBM EBCDIC - Japanese Katakana Extended |
| 20297 | IBM EBCDIC - France |
| 20420 | IBM EBCDIC - Arabic |
| 20423 | IBM EBCDIC - Greek |
| 20424 | IBM EBCDIC - Hebrew |
| 20833 | IBM EBCDIC - Korean Extended |
| 20838 | IBM EBCDIC - Thai |
| 20866 | Russian - KOI8-R |
| 20871 | IBM EBCDIC - Icelandic |
| 20880 | IBM EBCDIC - Cyrillic (Russian) |
| 20905 | IBM EBCDIC - Turkish |
| 20924 | IBM EBCDIC - Latin-1/Open System (1047 + Euro symbol) |
| 20932 | JIS X 0208-1990 & 0121-1990 |
| 20936 | Simplified Chinese (GB2312) |
| 21025 | IBM EBCDIC - Cyrillic (Serbian, Bulgarian) |
| 21027 | Extended Alpha Lowercase |
| 21866 | Ukrainian (KOI8-U) |
| 28591 | ISO 8859-1 Latin I |
| 28592 | ISO 8859-2 Central Europe |
| 28593 | ISO 8859-3 Latin 3 |
| 28594 | ISO 8859-4 Baltic |
| 28595 | ISO 8859-5 Cyrillic |
| 28596 | ISO 8859-6 Arabic |
| 28597 | ISO 8859-7 Greek |
| 28598 | ISO 8859-8 Hebrew |
| 28599 | ISO 8859-9 Latin 5 |
| 28605 | ISO 8859-15 Latin 9 |
| 29001 | Europa 3 |
| 38598 | ISO 8859-8 Hebrew |
| 50220 | ISO 2022 Japanese with no halfwidth Katakana |
| 50221 | ISO 2022 Japanese with halfwidth Katakana |
| 50222 | ISO 2022 Japanese JIS X 0201-1989 |
| 50225 | ISO 2022 Korean |
| 50227 | ISO 2022 Simplified Chinese |
| 50229 | ISO 2022 Traditional Chinese |
| 50930 | Japanese (Katakana) Extended |
| 50931 | US/Canada and Japanese |
| 50933 | Korean Extended and Korean |
| 50935 | Simplified Chinese Extended and Simplified Chinese |
| 50936 | Simplified Chinese |
| 50937 | US/Canada and Traditional Chinese |
| 50939 | Japanese (Latin) Extended and Japanese |
| 51932 | EUC - Japanese |
| 51936 | EUC - Simplified Chinese |
| 51949 | EUC - Korean |
| 51950 | EUC - Traditional Chinese |
| 52936 | HZ-GB2312 Simplified Chinese |
| 54936 | Windows XP: GB18030 Simplified Chinese (4 Byte) |
| 57002 | ISCII Devanagari |
| 57003 | ISCII Bengali |
| 57004 | ISCII Tamil |
| 57005 | ISCII Telugu |
| 57006 | ISCII Assamese |
| 57007 | ISCII Oriya |
| 57008 | ISCII Kannada |
| 57009 | ISCII Malayalam |
| 57010 | ISCII Gujarati |
| 57011 | ISCII Punjabi |
| 65000 | Unicode UTF-7 |
| 65001 | Unicode UTF-8 |
| Identifier | Name |
| 1 | ASCII |
| 2 | NEXTSTEP |
| 3 | JapaneseEUC |
| 4 | UTF8 |
| 5 | ISOLatin1 |
| 6 | Symbol |
| 7 | NonLossyASCII |
| 8 | ShiftJIS |
| 9 | ISOLatin2 |
| 10 | Unicode |
| 11 | WindowsCP1251 |
| 12 | WindowsCP1252 |
| 13 | WindowsCP1253 |
| 14 | WindowsCP1254 |
| 15 | WindowsCP1250 |
| 21 | ISO2022JP |
| 30 | MacOSRoman |
| 10 | UTF16String |
| 0x90000100 | UTF16BigEndian |
| 0x94000100 | UTF16LittleEndian |
| 0x8c000100 | UTF32String |
| 0x98000100 | UTF32BigEndian |
| 0x9c000100 | UTF32LittleEndian |
| 65536 | Proprietary |
- Product: The product the license is for.
- Product Key: The key the license was generated from.
- License Source: Where the license was found (e.g., RuntimeLicense, License File).
- License Type: The type of license installed (e.g., Royalty Free, Single Server).
- Last Valid Build: The last valid build number for which the license will work.
Setting this configuration setting to true tells the struct to use the internal implementation instead of using the system security libraries.
On Windows, this setting is set to false by default. On Linux/macOS, this setting is set to true by default.
To use the system security libraries for Linux, OpenSSL support must be enabled. For more information on how to enable OpenSSL, please refer to the OpenSSL Notes section.
Trappable Errors (IPInfo Struct)
IPInfo Errors
| 131 | Request queue is full. |
| 132 | Message for unknown request. |
| 134 | Invalid address string. |
| 310 | Adapter information is unavailable. |
SSL Errors
| 270 | Cannot load specified security library. |
| 271 | Cannot open certificate store. |
| 272 | Cannot find specified certificate. |
| 273 | Cannot acquire security credentials. |
| 274 | Cannot find certificate chain. |
| 275 | Cannot verify certificate chain. |
| 276 | Error during handshake. |
| 280 | Error verifying certificate. |
| 281 | Could not find client certificate. |
| 282 | Could not find server certificate. |
| 283 | Error encrypting data. |
| 284 | Error decrypting data. |
TCP/IP Errors
| 10004 | [10004] Interrupted system call. |
| 10009 | [10009] Bad file number. |
| 10013 | [10013] Access denied. |
| 10014 | [10014] Bad address. |
| 10022 | [10022] Invalid argument. |
| 10024 | [10024] Too many open files. |
| 10035 | [10035] Operation would block. |
| 10036 | [10036] Operation now in progress. |
| 10037 | [10037] Operation already in progress. |
| 10038 | [10038] Socket operation on nonsocket. |
| 10039 | [10039] Destination address required. |
| 10040 | [10040] Message is too long. |
| 10041 | [10041] Protocol wrong type for socket. |
| 10042 | [10042] Bad protocol option. |
| 10043 | [10043] Protocol is not supported. |
| 10044 | [10044] Socket type is not supported. |
| 10045 | [10045] Operation is not supported on socket. |
| 10046 | [10046] Protocol family is not supported. |
| 10047 | [10047] Address family is not supported by protocol family. |
| 10048 | [10048] Address already in use. |
| 10049 | [10049] Cannot assign requested address. |
| 10050 | [10050] Network is down. |
| 10051 | [10051] Network is unreachable. |
| 10052 | [10052] Net dropped connection or reset. |
| 10053 | [10053] Software caused connection abort. |
| 10054 | [10054] Connection reset by peer. |
| 10055 | [10055] No buffer space available. |
| 10056 | [10056] Socket is already connected. |
| 10057 | [10057] Socket is not connected. |
| 10058 | [10058] Cannot send after socket shutdown. |
| 10059 | [10059] Too many references, cannot splice. |
| 10060 | [10060] Connection timed out. |
| 10061 | [10061] Connection refused. |
| 10062 | [10062] Too many levels of symbolic links. |
| 10063 | [10063] File name is too long. |
| 10064 | [10064] Host is down. |
| 10065 | [10065] No route to host. |
| 10066 | [10066] Directory is not empty |
| 10067 | [10067] Too many processes. |
| 10068 | [10068] Too many users. |
| 10069 | [10069] Disc Quota Exceeded. |
| 10070 | [10070] Stale NFS file handle. |
| 10071 | [10071] Too many levels of remote in path. |
| 10091 | [10091] Network subsystem is unavailable. |
| 10092 | [10092] WINSOCK DLL Version out of range. |
| 10093 | [10093] Winsock is not loaded yet. |
| 11001 | [11001] Host not found. |
| 11002 | [11002] Nonauthoritative 'Host not found' (try again or check DNS setup). |
| 11003 | [11003] Nonrecoverable errors: FORMERR, REFUSED, NOTIMP. |
| 11004 | [11004] Valid name, no data record (check DNS setup). |