Using the Workbench to
define a TCP Listener device
To define a TCP Listener device, follow these steps:
- From the Workbench left pane, expand the node where you want to define the device
- Click Devices
The Devices tab appears as the right pane.
The Devices tab provides a table format that lists the previously defined devices. - To define a new device, click New at the bottom of the pane.
The Device window appears. The available device types are determined by the device support that is installed in this node. - Use the Type down-arrow to select the TCP Listener device under the TCP group.
- The Device window changes to accommodate the selected device type.
- To define a TCP Listener device, set this new device’s parameters as follows:
Parameter Description Name Enter a name for the TCP Listener device. Listener Type Controls how TCP connections are established. Select: - Passive - The TCP Listener device will accept connection requests from partner TCP applications.
- Active - The TCP Listener device will establish a connection to endpoints configured using the Device List parameter.
Port When Listener Type = Passive, the port on which to listen for TCP connections. The valid values are 1 - 65535.
The default value is 6000.Maximum Concurrent Connections The maximum number of clients that will be connected concurrently.
The default is 10.Message Timeout (sec) The timeout while waiting for the next chunk of a TCP message.
The default is 30 seconds.Inactivity Timeout (sec) The timeout while waiting for the next TCP message.
The default is 300 seconds.Message Type The Message Type indicates how to recognize the TCP data received as individual messages. You will be able to select one of the following: - Fixed Length
- Variable length with Terminating Characters
- Message Header
- Packet (When Packet is selected the listener will retrieve everything in the TCP buffer.)
Incoming Data Format The type of the incoming TCP data
- Binary
- StringFixed Length (bytes) Available when the Message Type is Fixed Length.
The size of data to receive to indicate a complete TCP message. The valid values are 1 - 64000.Terminating Characters Available when the Message Type is Variable Length with Terminating Characters.
The character or multi-byte terminating string used to indicate a complete TCP message. The default value is blank.Terminating Type Available when the Message Type is Variable Length with Terminating Characters.
The type for the Terminating Characters. The options are: ASCII or HEXADECIMAL.When the Incoming Data Format is Binary and the Terminating Type is ASCII, Terminating Characters in the extended ASCII range of 0X80 to 0XFF are not supported.
When the Incoming Data Format is Binary and the Terminating Type is HEXADECIMAL, a common way to terminate a TCP message is with Carriage Return and Line Feed characters, so the Terminating Characters are 0d0a.
Fixed header Size (bytes) Available when the Message Type is Message Header.
The size of the fixed header in bytes. The valid values are 1 - 64000. The default value is 1.Length Offset (bytes) Available when the Message Type is Message Header.
The bit offset of the TCP message size field in the message header. It does not include the Fixed Header Size. The value values are 0 - 63999. The default value is 0.Length Size (bytes) Available when the Message Type is Message Header.
The size of the TCP message size field in the message header. The valid values are 1 - 4. The default value is 1.Endianess Available when the Message Type is Message Header.
The order of the bytes within the message header. The valid values are Little or Big. The default value is Little.Device List Available when the Listener Type parameter is Active.
Used to configure a list of endpoints. The TCP Listener device will establish a connection to each endpoint configured, when the TCP Listener device is Started.
If a connection can not be established when the TCP Listener device is Started, or if a connection is terminated, the TCP Listener device will periodically attempt to reestablish a connection to the endpoint.Timeout Enter the timeout value to use when communicating with this device. This is entered in milliseconds. Per Variable Security
Select False to disable the allocation of additional memory to track User to Variable access for all Variables in this Device.
Select True to enable this feature if required. For more information, see Setting up Read Write per device variable. - Select Validate to have the parameters validated and temporarily Bind to the TCP port. If there is a problem with the validation, an error code will be displayed.
- Select Save to save the device definition. The device will appear in the Devices window list of devices.
- You can now control the device (
Start, Stop), access the device's variables by using the
Variables window, and build solutions that use the device's resources.