TCP Client

TCP Client

ID: uniflow.plugin.tcpclient Category: Network Protocol Version: v1.3.0 Min Uniflow Version: Uniflow ≥ v1.4.0

TCP Client Plugin Reference Manual

1. Overview

Plugin Name: TCP Client

Type: Generic Protocol

Identifier: uniflow.plugin.tcpclient

Description

Receive data from external systems via raw TCP sockets.


2. Technical Architecture

The TCP Client plugin handles raw socket transport over TCP/IP networks with optional SSL/TLS stream encryption. It maintains non-blocking asynchronous socket read/write loops, features exponential backoff reconnect timers, provides custom packet framing (CRLF, STX/ETX, Length-Prefixed, Idle Timeout), and converts raw byte payloads into string or JSON catalog telemetry.

System Interaction & Exposed Catalog Routes

The TCP Client plugin maintains raw TCP socket connections with remote host endpoints. It handles framing (delimiter, length prefix, fixed length), manages auto-reconnection logic, buffers incoming bytes, and transmits socket payloads.

Catalog Routes & Node Integration

Input Event Triggers (Input Nodes):

  • tcp.data_received - Emitted when a framed TCP data buffer arrives.
  • tcp.connected - Emitted when socket connection succeeds.
  • tcp.disconnected - Emitted on socket disconnect.
  • tcp.socket_error - Socket error or reset event.
  • Executable Actions (Action Nodes):

  • tcp.send_data - Writes a raw byte buffer to socket.
  • tcp.send_text - Sends a text string to TCP server.
  • tcp.reconnect - Reestablishes socket connection.
  • tcp.disconnect - Closes socket session.
  • Architecture Diagram

    VISUAL ARCHITECTURE FLOW DIAGRAM
    Rendering Flow Architecture Diagram...

    3. Configuration Parameters

    The following configuration fields are available in the User Interface for this plugin:

    Configuration SettingDescription
    Target Host / IP AddressSpecifies the target host / ip address.
    PortNumeric value specifying the port.
    Connect Timeout (ms)Numeric value specifying the connect timeout (ms).
    Reconnect Delay (ms)Specifies the reconnect delay (ms).

    4. Exposed Routes & Data Types

    This plugin exposes catalog fields across the following rule graph nodes:

    Input Source

    The Input Source node reads connection status and cached incoming socket data exposed by this plugin.

    Human-Readable Field NameData TypeDescription
    Last Received  String
    Raw string or formatted representation of the most recent message received on the TCP socket.

    Event Input

    The Event Input node listens for real-time socket data arrival events emitted by this plugin.

    Human-Readable Field NameData TypeExposed Event Fields & Data TypesDescription
    Data Received  Event Object
    Data (String)
    Payload (String)
    Length (Int32)
    Hex (String)
    Timestamp (DateTime)
    Asynchronous event triggered immediately whenever raw bytes or framed data arrive from the remote host.

    Output Target

    The Output Target node acts as an action sink node to send data over the open TCP socket.

    Target NameData TypeAssociated ParametersParameter Data TypeRequiredDescription
    Send Data  Json
    Message (message)StringTrueData payload to transmit over the network socket.
    Write Type (WriteTypeParam)StringTrueTransmission format (String or Byte).

    5. Usage Examples

    Scenario A: Raw TCP Barcode Scanner Telegram Triggers Milestone Bookmark & Modbus Conveyor Relay

    Workflow Overview:

    An industrial TCP barcode scanner sends a STX/ETX-framed ASCII string (tcp.data_received with Data == "PKG-88902-PASS"). Uniflow intercepts the socket packet and executes two actions:

    1. Writes a Modbus TCP coil (Coil 4 = True) to actuate a conveyor sorter arm.

    2. Triggers a video bookmark in Milestone XProtect.

    Rule Node Configuration:

    1. Event Input Node: TCP Client Listener

  • Filter Event: tcp.data_received
  • Exposed Fields: Data (String), Length (Int32), Timestamp (DateTime)
  • 2. Logic Condition Node: Contains

  • Expression: Data.Contains("PASS")
  • 3. Output Target Node A: Modbus Client Writer

  • Action Target: Direct Access
  • Type: Coils
  • Address: 4
  • Value: True
  • 4. Output Target Node B: Milestone XProtect

  • Action Target: Milestone Trigger Event
  • EventSourceGuid: CONVEYOR-CAM-01_GUID
  • Tag: Package Scan Pass
  • Logic Flow Diagram:

    VISUAL ARCHITECTURE FLOW DIAGRAM
    Rendering Flow Architecture Diagram...

    Scenario B: Security Intrusion Alarm Transmits ASCII Command Stream to Access Controller

    Workflow Overview:

    When SIA Receiver detects a perimeter breach (BA code), Uniflow formats an ASCII command payload ("LOCKDOWN:ZONE_1\r\n") and transmits it (tcp.send_text) over a persistent raw TCP socket to a legacy access control panel.

    Rule Node Configuration:

    1. Event Input Node: SIA Receiver Listener

  • Event Code: BA (Burglar Alarm)
  • Exposed Fields: AccountNumber (String), EventCode (String)
  • 2. Logic Formatter Node: String Formatter

  • Template: "LOCKDOWN:${AccountNumber}\r\n"
  • 3. Output Target Node: TCP Client Writer

  • Action Target: Send Data (tcp.send_text)
  • Message: Formatted lockdown string
  • WriteTypeParam: String
  • Logic Flow Diagram:

    VISUAL ARCHITECTURE FLOW DIAGRAM
    Rendering Flow Architecture Diagram...
    Architecture Flow Diagram — Full Preview