TCP/IP Client Trigger

Cloud_Business.png

To learn more about triggers in general, see section Understanding Triggers.

The TCP/IP client trigger turns your Automation into a listening client that connects to TCP/IP servers. There are multiple devices and systems that take the role of a TCP/IP server: vision inspection systems, printers, PLCs, scanners, weighing scales, etc. Automation can connect to them and wait for the incoming data. After receiving a certain number of characters, a character sequence, or a timeout, the TCP/IP client trigger fires, and starts executing your actions. If the connection fails, the trigger allows you to automatically reconnect.

Typical use: You are automatically printing multiple types of packaging labels using a network printer. It is crucial for you to know when your printer is done printing one label type before you start printing the second label type. The TCP/IP client trigger allows you to set permanent automated checking of printer availability. While printing the first label type, the TCP/IP client trigger checks for the printing status, and when the printer is done, it sends a message to Automation to send the second label type for printing.

General

  • Name: Specifies the unique name of the trigger. The names helps you distinguish between different triggers when you configure them in Automation Builder, and later when you run them in Automation Manager.

  • Description: Allows you to describe the role of this trigger. Help the users with a short explanation about what the trigger does.

  • Destination server: Type the location (IP address or hostname) of the TCP/IP server you wish to connect to.

  • Port: Specifies the host port number from which you are going to receive the incoming data. Make sure firewall ports are open on the server side.

  • Reconnect to server interval: Define the time in milliseconds after which Automation tries to reconnect to your TCP/IP server.

  • On number of characters received: Specifies that the trigger fires when the required number of characters is received. In this case, server can keep a connection open and continuously sends data. Each chunk of data must be of the same size.

  • On sequence of characters received: Specifies that the trigger fires each time the required sequence of characters is received. You would use this option if you know that the 'end of data' is always identified by a unique set of characters. You can insert special (binary) characters using the button next to the edit field.

    • Include in trigger data: The sequence of characters that determines the trigger event is not stripped of the data, but is included along with the data. The trigger receives the complete received data stream.

  • If nothing is received after the specified time interval: Specifies that the trigger fires after a required time interval passes since the last character is received.

Execution

  • Initialization message: Text message that goes to the server each time Automation establishes connection.

  • Answer message: Specifies the text message that returns to the server upon firing the trigger (before the actions start to execute).

  • Message encoding: Specifies the data encoding scheme, so the special characters can be correctly processed. Loftware Automation can automatically detect the data encoding, based on BOM header (text files), or encoding attribute (XML files).

Other

Options in the Feedback from the Print Engine section specify communication parameters that allow you to receive print engine feedback.

Cloud_Business.png
  • Supervised printing: Activates synchronous printing mode. Use it whenever you want to send the print job status back to the third party application. For more information, see section Synchronous Print Mode.

Options in the Data Processing section specify if you want to trim the data so that it fits into a variable, or ignore the missing label variables. By default, reports errors and breaks the printing process if you try to save values that are too long in label variables, or try to set values for non-existing label variables.

  • Ignore excessive variable contents: truncates data values that exceed the length of the variable as defined in the label designer to make them fit. This option is in effect if you are setting variable values in filters, from command files, and when you are setting values of trigger variables to label variables of the same name.

    Example

    Label variable accepts 5 characters at maximum. With this option enabled, any value longer than 5 characters is truncated to the first 5 characters. If the value is 1234567 ignores digits 6 and 7.

  • Ignore missing label variables: When printing with command files (such as JOB file), the printing process ignores all variables that are:

    Similar happens if you define assignment area in a filter to extract all name-value pairs, but your label contains fewer variables.

    When setting values of non-existing label variables, reports an error. If this option is enabled, the printing continues.

Options in Scripting section specify scripting possibilities.

  • Scripting language: Selects scripting language for the trigger. All Execute script actions that you use within a single trigger use the selected scripting language.

Options in the Save Received Data section specify the available commands for data that the trigger receives.

  • Save data received by the trigger to file: Enable this option to save the data received by the trigger. The option Variable enables variable file name. Select a variable that contains path and file name.

  • On error save data received by the trigger to file: Enable this option to save the data into the trigger only if an error occurs during the action execution. You might want to enable this option to keep the data that caused the issue ready for troubleshooting.

    Note

    Make sure you enable the Supervised printing support. If not, cannot detect errors during the execution. For more information, see section Synchronous Print Mode.

    Note

    saves the received data into a temporary file. This temporary file is deleted right after the trigger execution completes. The internal variable DataFileName points to that file name. For more information, see Internal Variables.

Security

  • Lock and encrypt trigger: Enables trigger protection. If you enable it, the trigger becomes locked and you cannot edit it any longer. This encrypts the actions. Only users with password can unlock the trigger and modify it.

Sending keepalive signals

Your network routing system can silently drop your connection when there is no TCP/IP traffic for a few minutes. To avoid being disconnected, you can choose to periodically send keepalive signals in Loftware Automation.

Enable sending keepalive signals in your product.config file:

  1. Navigate to the System folder.

    %PROGRAMDATA%\Loftware\Loftware

  2. Make a backup copy of the product.config file.

  3. Open product.config in a text editor. The file has an XML structure.

  4. Add the following lines:

    <configuration>
       <IntegrationService>
         <KeepAliveTime>60000</KeepAliveTime>
         <KeepAliveInterval>10000</KeepAliveInterval>
       </IntegrationService>
    </configuration>

    Note

    KeepAliveTime (in milliseconds): Specifies how long the TCP socket connection must be inactive before Automation sends a keepalive signal and waits for the acknowledge packets to be returned.

    KeepAliveInterval (in milliseconds): Specifies at what intervals to send anotherkeepalive packet when the host is not returning any acknowledge packets.

    When the TCP/IP trigger receives the keep alive packet and returns the acknowledge packet, the KeepAliveTime timer starts again.

    Both values (KeepAliveTime and KeepAliveInterval) are mandatory to enable sending keepalive signals and must have values larger than 0.

  5. Save the product.config file.

  6. Restart your Automation service.

Enabled keepalive signals now keep your connection active.