Device Driver: UDP

Communicating with a device via the UDP message driver uses the UDP/IP protocol and Windows sockets. The integrator end point may be set as a server (listening socket) or a client (connecting socket).

The recognised configuration properties are listed below:

Name Type Default Value Description
Server Boolean Default = False
Flag to indicate whether this is a server or client.
IPAddress IP address/host name Server IP address or name. It can also be used for TCP server to specify the local IP address the device will listen to. This is the case for PC with multiple network adapter with multiple IP addresses.
ClientPort port number Default = 15000
Indicates the port number to connect to. Optional in Server mode. See examples.
ListenPort / LocalPort port number Default = 16000
Indicates the port number Sym3 listens on. When both “ListenPort” and “LocalPort” are provided “ListenPort” will be used. Optional in client mode. See examples.
LocalIP IP Address Optional. For UDP Server Only. Default = 0.0.0.0
To specify the local IP address the device will listen to. This is the case for PC with multiple network adapter with multiple IP addresses. See examples.
MsgID Message ID Default = 0
Sym3 message number used for Server mode without the Sym3 Header. (StripHeader=true)
StripHeader Boolean When messages are sent and received the Sym3 Header is not sent as part of the message on the network. This allows devices that do not use the Sym3 Header to communicate with Sym3.
ReconnectTime Unsigned Integer Default = 5
Time between client reconnection attempts (seconds). Valid for client only
NetworkByteOrder Boolean Default = False
Identifies the endian order of the message header numeric values. The device IO contents are treated as single bytes therefore not swapped.
Autoconnect Boolean Default = True. (optional true if not specified)
If false, Sym3 won’t connect to this device until an explicit call to ConnectDevice() is made from the script.
BufferSize Number Optional. Default = 1024
Number of bytes for the buffer used for communication. Default 1024 bytes
ContinuouslySendingOutput Boolean Optional. Default = False
Output messages are sent only if an output data has been changed. If you want Sym3 to continuously send messages you can set the flag to ‘True’. Warning: this may affect performance significantly. Sym3 does not recommend using this setting. The update rate used will be the UpdateRate set for output data. The only way to change this is to export DeviceIOs to CSV file and change the last column then re-import the CSV file. Default rate is set to 50ms.

Configuration data is not case sensitive and white space is ignored.

Examples

Server examples

1- Sym3 listening on specific port with one or more devices sending Datagrams. Sym3 receives UDP Datagram and assigns message number 100 for Sym3 Device IO / Scripts to process. Sym3 Headers are not sent on the network.

Configuration:

server = true
listenport = 16000
stripheader = true
msgid = 100

2 - Sym3 listening on specific port with one or more devices sending Datagrams. Sym3 sends messages to each of the clients. Messages may be sent to specific client or to all clients by sending using the Sym3 Server Device (MyServer).

The clients must have the ListenPort set to the MyServer listen port. Client ports may be different from each other.

Configuration:

MyServer:

server = true
listenport = 16000

Device1:

server = false
ipaddress = 192.168.1.1
clientport = 17000
listenport = 16000

Device2:

server = false
ipaddress = 192.168.1.2
clientport = 17001
listenport = 16000

Device3:

server = false
ipaddress = 192.168.1.3
clientport = 17000
listenport = 16000

3 - Sym3 listening on specific port and sending Datagrams to a device / server listening on specific port.

Configuration:

server = true
ipaddress = 192.168.1.1
listenport = 16000
clientport = 16000

4 - Sym3 listening on specific ip and port using “LocalIp” and “LocalPort” with one or more devices sending Datagrams. This is the case for a PC with multiple network adapters with multiple IP addresses.

UDP clients can also use “LocalIp” and “LocalPort” to listen , but all the clients connecting to one udp server must be listening to the same port because UDP is connectionless, the server broadcasts the message on given port unlike TCP where messages are sent to each client separately

Configuration:

server = true
localport = 17000
localip=192.168.1.2

Client Example

Sym3 connecting to device on specific port and using random assigned port from host operating system. Device replies to peer (Sym3) port.

Configuration:

server = false
ipaddress = 192.168.1.1
clientport = 16000
reconnecttime = 10
networkbyteorder = false