TCP/IP Connectors


TCP/IP is an abbreviation for Transmission Control Protocol / Internet Protocol. It is a set of protocols that define how two or more computers can communicate with each other. The protocol is effectively a set of rules that describe how the data is passed between the computers. It is an open standard so can be implemented on any computer with the appropriate physical attributes. 

Properties Tab

If Properties need to set for the TCP connector, for example for a TCP/IP connector to an HSM the key = textline must be set to the value = true as shown in the example below.

As another example, by default, TCP/IP Connectors are asynchronous. If you require the Connector to be synchronous, the key = synchronous must be set to the value = true.

Decoder / Encoder Configuration

As a final, slightly more complex example, a messages sent over TCP/IP include a variable byte length header known as the Variable Length Indicator (VLI), proper configuration of the decoder and encoder is important. Here’s how to handle such requirements:

Variable Length Indicator (VLI):

  • Typically consisting of 2 bytes, the VLI precedes every message sent to or from the TCP/IP endpoint.
  • Bytes 1-2 indicate the number of bytes in the message, excluding the first 2 bytes.
  • These 2 bytes represent a 16-bit unsigned integer in network byte order.
  • Note: If the message is compressed before transmission, it must first be compressed to determine its length. As an example, suppose that you were to look at just the text (excluding the 2 byte header) making up an XML message from a particular example and that you then counted the characters and they happened to add up to 299 characters. If you took a scientific calculator (the one in Windows for example) and you typed in 299 with “Dec” (for decimal) selected, then you select “Hex”, the value that would be shown is “12B”, which means the same as 01 2B, which is exactly what one would expect to see for the first two bytes of the message if the message had been dumped to a file and then opened with a hex editor.

Configuration Properties:

  • Configure the decoder type as ‘StringDecoder’ and the encoder as ‘LengthFieldPrepender’.
  • Set the length to ‘2’ to handle the 2-byte VLI.
  • Additionally, set the property ‘useByteBuf’ to ‘true’. This instructs GLU to convert the message body into ByteBuf before transmission, allowing for efficient byte-level manipulation.

    In the screenshot below the above described Decoder / Encoder and Field Length settings are shown. Additionally you’ll see the TCI/IP property key = usebyteBuf is set to value = true … with this setting GLU will turn the message body into ByteBuf before sending it out. Just like an ordinary primitive byte array, ByteBuf uses zero-based indexing. It means the index of the first byte is always 0 and the index of the last byte is always capacity – 1.

    Was this article helpful?

    Related Articles

    Need Support?

    Can't find the answer you're looking for?
    Contact Support
    Fill the form and we’ll contact you shortly

      I agree with

      We uses cookies to make your experience on this website better. Learn more
      Accept cookies