UDP communication is simple and easy to set up but also unsecure in the way that you do not know if a datagram is received or not. This is normally not a problem for VSCP as there is almost always a way to determine that an event has been received. A typical example is a lamp that should be turned on. The controller typically send
we then expect the receiving node to reply with
to verify that the lamp was turned on. It is therefore easy to make sure a command has been received by a remote node and has been carried out and if not resend.
The VSCP server can be setup to receive UDP datagrams on a specific port and it can be setup to send VSCP events to a specified number of nodes. Filters can be used to limit sent and received events. It is possible to get an automatic acknowledgement event when a VSCP UDP event is received by the VSCP server. Encryption is available in the form of AES128/AES192/AES256 or unencrypted frames.
One can send unencrypted frames to the VSCP server. This means that anyone can send a VSCP event to a central VSCP server/system. This will of course be very dangerous on most systems. You can specify a user that the UDP sub system will be acting as and this gives some possibilities to limit the what can be sent and be received. Best is to use encrypted frames. Here the remote node and the server share a secret key and therefore they can trust each other using state of the art encryption. This also makes it impossible for someone that is not authorized to see what is sent on the wire or over the air.
The full configuration is described here.
The configuration consist of two parts.
The second thing to configure is the interface to use. This is typically udp://44444 which says "listen on all interfaces and use port 44444 (default)". One can use an IP address like udp//:192.168.1.45:44444 to listen only at a specific interface.
Next you should consider using a user account that UDP connections use. You do this by setting the username in user and the password in password. Password should be set as salt;password in the standard way. By doing this you can specify which events that can be received and from which IP addresses. Leave both user and password bland to not connect to a user account.
The next thing is to decide if you should allow unencrypted frames. You do this by setting bAllowUnsecure to "true". If set to "false" only encrypted frames will be received.
With bSendAck you can decide if the node sending an UDP frame should get an acknowledge event back. If set to //"true"// a CLASS1.ERROR, Type=0, Success event will be replied on success and a CLASS1.ERROR, Type=1, Error is sent if something is wrong with the UDP frame. If set no //"false"// no acknowledgement frames will be sent.
By setting the filter/mask you can filter out unwanted events. Both filter and mask is set as text strings on the form "priority;class;type;guid"
With guid you set the GUID for the interface. If empty or all set to zeros the system will set a GUID for you.
interface is the address and port of the receiving node. It should be entered on the form udp//:192.168.1.45:29001
By setting the filter/mask you can filter out events that should not be sent to this node. Both filter and mask is set as text strings on the form "priority;class;type;guid"
Encryption tells how the sent UDP frames should be encrypted. Valid values are "none"/"aes128"/"aes192"/"aes256" and empty
You can find some sample/test code here.
Thu Jan 17 2019 17:41:36 GMT+0000 (UTC)
This document is licensed under Creative Commons BY 4.0 and can be freely copied, redistributed, remixed, transformed, built upon as long as you give credits to the author.