TCP and UDP for components with provider networks
Introduction
This article provides detailed technical information about the TCP and UDP protocols for components with a provider network. Using the provider network, (almost) any devices can be connected to NeuroomNet, which can be controlled via the network protocols TCP and UDP (and Telnet) and sent character strings (see Provider Network).
This chapter provides technical background information about TCP and UDP.
Overview of communication
In this chapter we look at the following aspects of communication between the device (represented in NeuroomNet by a component) and NeuroomNet (or the provider network / component), primarily from the perspective of the NeuroomNet server for the TCP and UDP cases:
- Sending actions to the device via text messages (defined in the respective PRT file) from NeuroomNet (and receiving these actions from the device)
- Receive events from the device via text messages (defined in the respective PRT file) in NeuroomNet (and send these events through the device)
- Knowledge from NeuroomNet as to whether the respective device is currently switched on and accessible in the network
- Knowledge from NeuroomNet as to whether sent actions have arrived at the respective device page
- Knowledge from NeuroomNet as to whether sent actions were (successfully) carried out by the respective device
Communication using TCP
In order to connect a corresponding device to NeuroomNet using TCP, you create a component in the Setup module in NeuroomNet with the following minimum settings
- IP:Port (destination) 2: IP address and the port to be used of the respective device in the network (e.g.: 192.168.100.36:5678)
- Device protocol 3: Name of the PRT file to be used (e.g.: netIOIn16 (prt))
- [ID 1: Any but unique character string for use and display within NeuroomNet]
The following information will usually be specified in the external device, device-specific:
- If necessary, port number of the NeuroomNet server, at least if the device is supposed to send events and the device does not always only respond to requests (actions) from NeuroomNet (and this response is automatically sent to the source IP address / port of the action becomes))
If the device is successfully connected to NeuroomNet via TCP via a component, then
- Allow NeuroomNet to send actions (defined via the PRT) to the device
- NeuroomNet allows events (defined via the PRT) to be received/processed by the device (e.g. via script blocks)
- NeuroomNet knows at all times whether the device is currently available in the network and switched on (the TCP protocol maintains a connection)
- The TCP protocol guarantees that actions / events are sent and received successfully, but there is no information as to whether actions or events were actually (successfully) carried out (this would otherwise have to be supported by the device / PRT / script blocks via status Events/requests or similar; the result of actions is often visible indirectly, as a device changes its status accordingly or similar, which is visible on a dashboard, for example)
Communication using Telnet
Using the “Use TELNET protocol (TCP only)” switch, a connection via the rather old Telnet protocol is also possible.
For the user of NeuroomNet, the Telnet protocol ultimately behaves like the TCP protocol, but certain control characters are still used in the background (transparent to the user) to establish the connection.
Communication using UDP
In contrast to TCP, UDP is "connectionless" and "not reliable" (see Wikipedia; in practice, UDP devices can also be used almost equivalently) . This causes minor differences in the connection to NeuroomNet - each marked in bold font:
In order to connect a corresponding device to NeuroomNet using UDP, you create a component in the Setup module in NeuroomNet with the following minimum settings
- IP:Port (destination) 2: IP address and the port to be used of the respective device in the network (e.g.: 192.168.100.36:5678)
- Device protocol 3: Name of the PRT file to be used (e.g.: netIOIn16 (prt))
- Use UDP protocol (not TCP) 4: This checkbox / switch must be set accordingly so that UDP is used
- Wait for UDP replies (milliseconds, UDP only) 5: Specify milliseconds if necessary
- A specification of milliseconds indicates how long the respective (possibly temporary, depending on operating system settings) (source) port through which a NeuroomNet action is sent is kept open
- This only affects devices that respond directly to NeuroomNet actions instead of sending responses to a predefined IP address and port or for most devices nothing is entered here
- To avoid wasting resources, this time should be as small as possible and only as large as necessary - in normal scenarios one second is more than sufficient, but of course this depends on the connected hardware
- [ID 1: Any but unique string for use and display within NeuroomNet]
The following information will usually be specified in the external device, device-specific:
- If necessary, IP address and Port 15403 of the NeuroomNet server, at least if the device is to send events or messages independently and the device does not always only respond to requests (actions) from NeuroomNet (to the source IP address). Address / port))
- If the device responds directly to NeuroomNet actions (to the source IP address / port), the setting "Wait for UDP responses (milliseconds, UDP only" must be set on the NeuroomNet side (see above )
- [In the case of TCP, this setting is omitted on the NeuroomNet side because with TCP a connection is kept open anyway]
Note 1: Port 15403 may not yet be available in older NeuroomNet installations or may not be accessible from outside. In such a case, if necessary, please contact inSynergie.
Note 2: Ultimately, there are two types of UDP-controllable devices that also send messages to NeuroomNet:
- Devices in which a fixed IP address and port from NeuroomNet is specified where the messages are sent
- Devices that respond directly to NeuroomNet actions
Most devices belong to the first type and here you enter port 15403 (and IP address of the NeuroomNet server) in the configuration of the device itself.
For devices of the second type, the setting “Wait for UDP responses (milliseconds, UDP only)” must be used.
Attention: In both cases, there must always be a component on the NeuroomNet side for the IP address of the UDP device so that incoming events (to port 15403 or as a "response") are processed by NeuroomNet or as an event of the respective component can be interpreted.
If the device is successfully connected to NeuroomNet via a component via UDP, then
- Allow NeuroomNet to send actions (defined via the PRT) to the device
- NeuroomNet allows events (defined via the PRT) to be received/processed by the device (e.g. via script blocks)
- NeuroomNet never knows whether the device is currently available in the network or switched on (the device is always displayed in green in the Setup module)
- It is also not guaranteed that actions/events will be received successfully