Provides an IP address. More...
Import Statement: | import ArcGIS.AppFramework.Networking 1.0 |
Properties
- address : string
- isLoopback : bool
- isMulticast : bool
- isNull : bool
- protocol : Protocol
- scopeId : string
Methods
- clear()
- bool isInSubnet(const networkaddress subnet, int netmask)
Detailed Description
The NetworkAddress component holds an IPv4 or IPv6 address in a platform and protocol-independent manner. It also contains components to determine the nature of the IP address. This component is normally used along with others to connect to a host, or set up a server.
The following code sample demonstrates usage of the NetworkAddress component. Pressing the button created by this sample will log a list of available network addresses to the console, including protocol and whether the address is multicast or loopback.
Item { Button { id:mybutton anchors { left: parent.left top:parent.top margins: 10 } text: "Get Network Addresses" onClicked: { for(var i = 0; i< Networking.addresses.length; i++) { var networkAddress = Networking.addresses[i] console.log("Address is %1 \n Protocol is %2 \n isMulticast %3 \n isLoopback %4".arg(networkAddress.address).arg(networkAddress.protocol) .arg(networkAddress.isMulticast.toString()).arg(networkAddress.isLoopback.toString())) } } } }
Enumerations
Protocol enumeration
This enum describes the preferred internet protocol (IP) to use for networking.
Name | Value |
---|---|
NetworkAddress.ProtocolUnknown | -1 |
NetworkAddress.ProtocolIPv4 | 0 |
NetworkAddress.ProtocolIPv6 | 1 |
NetworkAddress.ProtocolAny | 2 |
Property Documentation
Returns true if the address is a loopback address.
For IPv6, this loopback address is 0:0:0:0:0:0:0:1 (or simply ::1), while for IPv4 the 127.0.0.0 to 127.255.255.255 addresses are reserved for loopback.
Returns true if the address is an IPv4 or IPv6 multicast address. Otherwise, returns false.
Returns the scope of an IPv6 address. If the address is IPv4, or does not contain a scope ID, returns an empty string.
Method Documentation
Returns true if the IP is in the subnet described by the given subnet and netmask.
The subnet parameter
The subnet the IP is being looked for in. This can be any address belonging to the subnet, it doesn't have to be the network address (the lowest number in the subnet) itself.
The netmask parameter
The netmask to look for the address within. The netmask is the last number in an IP address.