Skip to main content
Version: Next

TCP / UDP

For equipment that has no industrial protocol at all: bench scales, barcode and RFID readers, weather stations, laboratory instruments, serial devices behind an Ethernet gateway, and in-house protocols. QUBIQ opens the socket, splits the byte stream into messages, and lets you map fields to tags.

Configuration

FieldDescription
NameConnection identifier.
HostDevice IP or hostname (for client role).
PortDevice port, or the port to listen on in server role.
Transporttcp or udp.
Roleclient — QUBIQ connects out. server — QUBIQ listens and the device connects in.
Frame modeHow the byte stream is split into messages. See below.
DelimiterFor delimiter framing: the terminator, e.g. \r\n, \n, \x03.
Frame sizeFor fixed-length framing: bytes per message.
Max message bytesHard cap; a message larger than this is discarded rather than buffered indefinitely.
Field delimiterSplits a message into fields, e.g. , for CSV, \t, ;.
Field countExpected number of fields. A message with a different count is rejected.
WriteableAllows tags on this connection to send data to the device.
Connect timeout (ms)Socket connect timeout.
Inactivity timeout (ms)Reconnect if nothing is received for this long.

Framing

A TCP stream has no message boundaries — framing is how you recover them. Getting this wrong is the usual cause of "half a reading" or "two readings stuck together".

Frame modeUse whenNotes
DelimiterThe device terminates each message (\r\n, \n, ETX)The most common case.
Fixed lengthEvery message is exactly N bytesBinary protocols with a fixed record.
NoneUDP, where each datagram is already a messageDo not use for TCP.

UDP preserves datagram boundaries, so framing is usually unnecessary — but UDP also loses datagrams silently and may reorder them. Do not use it for anything you must not miss.

Field mapping

With a field delimiter configured, a message is split and each field becomes addressable by index. A binding's address is the field index.

Message: "ST,GS,+ 12.345,kg\r\n"
Fields: 0="ST" 1="GS" 2="+ 12.345" 3="kg"

Tag Scale/Status → address 0
Tag Scale/Weight → address 2 (data type float)
Tag Scale/Unit → address 3

Field count is a cheap integrity check: a truncated or concatenated message has the wrong number of fields and is rejected rather than parsed into wrong tags.

Binding tags

FieldNotes
AddressField index, or the whole message for a single-value protocol.
Polling modesubscribe for a device that pushes continuously; write for outbound-only tags.
Data typeSet it — text "12.345" becomes a number only if the tag says float.

Writing to the device

With writeable enabled, writing a tag transmits its value on the socket. The framing configuration is applied on the way out: the delimiter is appended, or the payload is padded to the fixed length.

Use this for command protocols — tare a scale, trigger a reader, request a measurement.

Quality and liveness

A raw socket gives no quality information, so QUBIQ infers it:

ConditionQuality
Message parsed, field presentGood
Socket down or reconnectingBad
Message rejected (bad field count, oversized)Previous value retained, event logged
Nothing received within stale afterUncertain / stale

Set stale after on tags fed by a push-only device. Without it, a dead device is indistinguishable from a quiet one. → Tag properties

Security

Raw TCP/UDP has no authentication and no encryption. Anyone who can reach the port can send data that QUBIQ will parse into tags.

  • Keep these devices on an isolated segment.
  • In server role, bind to a specific interface and firewall the port.
  • Never expose a server-role TCP/UDP connection to an untrusted network.
  • Treat values from it as untrusted input: validate ranges on the tag, not just in the display.

Troubleshooting

SymptomCheck
Values are truncated or concatenatedWrong frame mode or delimiter. Capture the raw stream and look at the actual terminator.
Some messages ignoredField count mismatch — the device emits a status message with a different shape.
Data stops after a whileDevice closed the socket; set inactivity timeout so QUBIQ reconnects.
Nothing at all, client roleThe device may be a server-only device expecting QUBIQ to listen — switch roles.
Numbers arrive as stringsSet the tag's data type; leading spaces and + signs are handled on conversion.
Works then breaks after a firmware updateVendors change delimiters and field order between versions. Re-capture.

Next

SQL databases