NetworkAddress QML Type

Provides an IP address. More...

Import Statement: import ArcGIS.AppFramework.Networking 1.0

Properties

Methods

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.

NameValue
NetworkAddress.ProtocolUnknown-1
NetworkAddress.ProtocolIPv40
NetworkAddress.ProtocolIPv61
NetworkAddress.ProtocolAny2

Property Documentation

address : string

Returns the connection's current IP address.


[read-only] isLoopback : bool

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.


[read-only] isMulticast : bool

Returns true if the address is an IPv4 or IPv6 multicast address. Otherwise, returns false.


[read-only] isNull : bool

Returns true if the host address is null.


[read-only] protocol : Protocol

Returns the network layer protocol of the host address.


scopeId : string

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

clear()

Sets the host address to 0.0.0.0.


bool isInSubnet(const networkaddress subnet, int netmask)

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.


Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.