ArcGIS for Developers

UdpSocket QML Type

Provides a User Datagram Protocol (UDP) socket. More...

Import Statement: import ArcGIS.AppFramework.Networking 1.0
Inherits:

AbstractSocket

Properties

Signals

Methods

Detailed Description

A subcomponent of AbstractSocket, the UdpSocket component provides a UDP (User Datagram Protocol) socket; a lightweight, unreliable, datagram-oriented protocol. It can be used when reliability isn't a priority.

This code sample from AppStudio Player demonsrates usage of UdpSocket, returning information from the SSDP listener when a datagram has been received.

UdpSocket {
    id: socket

    onDatagramReceived: {
        console.log("datagram: ", datagram);
        console.log("address: ", address);
        console.log("port: ", port);
    }

    onStateChanged: {
        console.log("SSDPListener status:", state);
    }

    onErrorChanged: {
        console.log("SSDPListener error:", error, errorString);
    }
}

Property Documentation

multicastInterface : NetworkInterface

Returns the interface for the outgoing interface for multicast datagrams.


Signal Documentation

datagramReceived( object datagram, string address, ushort port)

Signal emitted when a datagram has been received.


Method Documentation

bool joinMulticastGroup(groupAddress)

Joins the multicast group specified by groupAddress. Uses the default interface for the device.

The groupAddress parameter

IP or web address of multicast group to join.


bool joinMulticastGroup(groupAddress, networkinterface networkInterface)

Joins the multicast group specified by groupAddress, on the given interface.

The groupAddress parameter

IP or web address of multicast group to join.

The networkInterface parameter

The network interface to join the group on.


bool leaveMulticastGroup(groupAddress)

Leaves the multicast group specified by groupAddress. Uses the default interface for the device.

The groupAddress parameter

IP or web address of multicast group to leave.


bool leaveMulticastGroup(groupAddress, networkinterface networkInterface)

Leaves the multicast group specified by groupAddress, on the given interface.

The groupAddress parameter

IP or web address of multicast group to leave.

The networkInterface parameter

The network interface to leave the group on.


sendDatagram(datagram, string address, ushort port)

Sends the held datagram to the given address, through the defined port.

The datagram parameter

The datagram you're sending.

The address parameter

The address you're sending the datagram to.

The port parameter

The name of the port to send the datagram through.