Device Driver: TCP/IP
Communicating with a device via the TCP message driver uses the TCP/IP protocol and Windows sockets.
The integrator end point may be set as a server (listening socket) or a client (connecting socket).
Ping / ICMP must be enabled on the server before connecting to the device, as it is used by Sym3 to check availability.
The recognised configuration properties are listed below:
Name | Type | Description | |
---|---|---|---|
Server | Boolean | 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. | |
Port | port number | Indicates the port to listen on, or connect to | |
ReconnectTime | Unsigned Integer | Default = 5 seconds 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. |
|
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 | |
Autoconnect | Boolean | (optional true if not specified). Default = True If false, Sym3 won’t connect to this device until an explicit call to ConnectDevice() is made from the script. |
|
LocalIP | IP Address | Optional. For TCP client Only. Default = 0.0.0.0 To specify the local IP address the device will connect from. This is the case for PC with multiple network adapter with multiple IP addresses. |
|
LocalPort | port number | Optional. For TCP client Only. Default = 0 To specify the local port number the device will connect from. |
|
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. |
|
ReceiveBufferSize | Integer | Optional. Default = 2048 If the size of received is more than the buffer size, then it will be split into multiple messages. |
Configuration data is not case sensitive and white space is ignored.
Examples
Server example
server = true
port = 16000
stripheader = true
msgid = 100
ipaddress = 192.168.25.56 // IP on which server listen to (Optional for PC with multiple IPs)
receivebuffersize = 4096
Client example
server = False
ipaddress = 192.168.25.56
port = 16000
localip = 192.168.25.55 // IP on which client will connect from (Optional for PC with multiple IPs)
localport = 10000 // Local port from which client will connect (Optional)
reconnecttime = 10
NetworkByteOrder = false
receivebuffersize = 4096
Sym3/PLC example
These simple examples include conveyors and PEs to demonstrate the setup and principles of operation.
- Example project: Sym3-NJ1-TCP.s3i
- Example PLC code: PLC-NJ1-TCP.smc2
Important Notes
TCP provides reliable, ordered, and error-checked delivery of a stream of octets (bytes) between applications. It is guarantee that data sent will be received without loss.
TCP is a stream protocol.
If the rate of messages is high, TCP will start to concatenate messages into the same TCP packet. Sym3 is sending each message individually but concatenation can happen. Is is very obvious when the frequency is high (for example using an Output Rate of 5ms).
Structure of a Sym3 Message
Note: See Messaging for more details on Sym3 Header and Body
Structure of a TCP Packet
Concatenation
When Concatenation is happening, the TCP packet can look like this:
or
The receiver of the message can receive multiple messages in one packet.
It is the receiver responsibility to read all those messages in a single packet.