Skip to main content

UDP server

Requirements

  • Android application with version 3.0.88 or higher.
  • Windows application with version 3.1.301 or higher.
  • JSCore application with version 4.1.396 or higher.

Setup

Configuration

In order to utilize the UDP server, it is necessary to apply a configuration to your device(s).
You have to configure the settings through the right-click menu on the device(s):

Device Properties >> Set >> Set sensor configuration

{
"services": [
{
"uid": "udp",
"type": "UDP",
"settings": {
"address": "224.0.0.3",
"port": 5974
}
}
]
}
info

In the configuration, the address is UDP Multicast Address.

  • The UDP Multicast Address is a way for one device on a local network to send a message to all other devices on the same network simultaneously, kind of like a public announcement that everyone can hear.

In this particular instance, we are using port 5974. However, if you have a preference for a different port, please feel free to use it.


Please ensure that the port you specify in the configuration matches the port you are using in the content.


Content

We will transmit a message from the Sender Device to the Target Device.
To confirm the reception of the message by the Target Device, it will be relayed back to the Sender Device.

Get the IP address

To utilize UDP server between 2 devices, you have to know the IP addresses of the devices.

How to find the ip address

You can find the IP address of a device if you have to right click on the device you wish to use and select SCREEN INFO where you have to find the Network section. The device's IP address is the Network 0 IP.

Create the sender / receiver content

1. Create 2 text widget boxes. Fill the box of the first one with the text send

2. Add 2 more text widgets with number 1 and 3. The forwarder content will contain number 2

Your content should look like this:


udp2.png


Send to target device | action

1. Click on the text widget that contains the send.

2. Navigate yourself to the PROPERTIES >> WIDGET >> OTHER >> EDIT TOUCH EVENTS

3. Click on the ADD NEW button, then select the Send static UDP message action in the Action type: field

img.png

4. Fill the Target address: field with the IP address of the device you wish to use as Target device, then add the port next to it.

Like this: <deviceIP>:port

  • this action will send the message to the Target device
Target Tag

You can also set device tags separated by commas in Target tag: field.

5. Save it then go to the PROPERTIES >> CONTENT >> EDIT SENSOR EVENTS

6. Set the following actions to visually see the in- and outcoming events.

img.png

  • The first action will alert you in the second text widget that the event has been received
  • The second one will alert you in the send text widget that the event has been sent to the target device

Do not forget to fill the Sensor event: fields with the event you sat in the send widget's action


Save it, save the content then assign it to the Sender device.


Create the forwarder content

1. Create 1 text widget

2. Create another one then fill it with number 2

Your content should look like this:


img.png


Send back to sender device | action

1. Navigate yourself to the PROPERTIES >> CONTENT >> EDIT SENSOR EVENTS

2. Click on the ADD NEW button, then select the Send dynamic UDP message action in the Action type: field

3. Fill the Sensor event: field with the event you sat in the content of the sender device.

4. In the Target device: field you have to write the Sender device's IP address with the port, this way the event can be forwarded to the device where it came from.

img.png

5. Then add this indicator action to see the event's actual state

img.png


Save it, save the content then assign it to the Target device.


Final steps

  • When both of your contents are assigned to the devices, click on the send widget
  • You will see the messages in the widgets where the event has been received.

If the 3rd text widget shows the Event Received!!! message, then your devices are ready to communicate with each other.

Downloadable content