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.

Note: The corresponding handler is onDatagramReceived.


Method Documentation

bool joinMulticastGroup(var 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(var 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(var 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(var 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(var 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.


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