Receive TCP Message

A Receive TCP Message event trigger executes when a TCP message is received.

Defining a Receive TCP Message event trigger

To define a Receive TCP Message event trigger, follow these steps:

  1. From the Workbench left pane, expand the node where you want to define the Receive TCP Message event trigger.
  2. Select the Project icon to display the Projects window, right-click a specific project tab to display its pop-up menu, and then select New.
    You also can select the New button at the bottom of the Projects window when a specific project tab has already been selected.
  3. The new Trigger window appears.
    Name the trigger. The trigger name can be up to 64 characters and include letters, numbers, and the underscore character. Spaces are allowed.
  4. From the Event tab, select the Trigger Event Type down-arrow, expand the Networking category, and then select Receive TCP Message.
     
    The Event tab becomes active with parameters that accommodate the Receive TCP Message event.
Parameter Description
Device Name The TCP Listener device that supports the TCP connection that receives TCP messages from partner applications.
Reply Format The data format of an optional reply message.

Receive TCP Message event type trigger event variables

The input event variables available to a Receive TCP Message event trigger are:

Event variable Data type Description
Data Based on the option selected for the Incoming Data Format parameter in the TCP Listener device. The data received by the TCP Listener device.
Data Length UINT4 The size of the TCP data received by the TCP Listener device.
Device Name STRING The name of the TCP Listener device.
Source Address STRING The IP Address:port that the data was received from.
Label STRING If the TCP Listener device, Listener Type parameter is set to Active, the connection that the data was received from may have an optional label associated with it.
Label Populated Boolean Indicates if the Label event variable is populated

The output event variables available to a Receive TCP Message event trigger are:

Event variable Data Type Description
Reply Data Based on the Reply Format parameter selection type. Optional field present if the Reply Format property is set to any option other than None.

If set, the Reply Data will be sent over the connection that received the original TCP message.

Receive TCP Message event trigger considerations

  • The selected TCP Listener device must be Started for the Receive TCP Message event trigger to receive data.
  • The TCP message handling behavior (fixed message length, variable message length with terminating characters, defined message header) is defined in the TCP Listener device Message Type parameter.
  • Multiple Receive TCP Message event triggers can be defined and started referencing the same TCP Listener device.
    Each trigger will receive a copy of the TCP message received by the TCP Listener device.
  • If multiple sending partner applications are sending TCP messages to the same IP address and port, then each sent TCP message will be received as a separate and distinct Receive TCP Message event trigger execution. The trigger execution behavior is based on the trigger settings for Max in Progress and Queue Size.
  • The TCP driver and the TCP Listener device supports sending data back to the partner TCP application that sent the TCP message, through the Reply Data event variable.
Related topics

TCP Listener Status

Receive UDP Message

TCP Listener