Configure the Socket Client Connector
Connect SIA Connect to a TCP socket server, exchange delimited text or hexadecimal messages, and configure TLS or mutual TLS.
The Socket Client Connector opens an outbound TCP connection from SIA Connect to a socket server. Use it to send commands, receive delimited messages, perform request-and-reply communication, or send mapped values to a TCP service.
The Connector supports plain TCP, TLS server verification, and mutual TLS. Messages can be sent as UTF-8 text or decoded from hexadecimal input.
Socket communication does not define the meaning or structure of a message. Confirm the server's encoding, delimiter, command format, and reply behavior before configuring the Connector.
Before you begin
- Install the Socket Client TCP/IP Connector. See Install and manage Connectors.
- Obtain the server's hostname or IP address and TCP port.
- Allow SIA Connect to reach the server through the required network and firewall rules.
- Confirm whether the connection uses plain TCP, TLS, or mutual TLS.
- Confirm the message encoding and delimiter expected by the server.
- For request-and-reply communication, obtain the command that requests the required value.
- For TLS, upload the required certificates and keys before creating the instance.
Protect private keys and client certificates. Only upload files issued for the intended SIA Connect device and server environment.
Choose the communication pattern
| Pattern | Item | Command | Behavior |
|---|---|---|---|
| Receive unsolicited messages | Read socket | Empty | The Connector waits for a message ending with the configured delimiter. A read timeout is ignored when no command was sent. |
| Send a request and receive a reply | Read socket | Configured | The Connector sends the command and delimiter, then waits for a reply ending with the same delimiter. |
| Send mapped values | Write socket | Optional | The mapped value and delimiter are sent to the server. When the mapped value is empty, Command is used as a fallback. |
| Send a fixed command | Write socket | Configured | The configured command and delimiter are sent when the item is written without another value. |
The Connector keeps one connection for each instance and reuses it across reads and writes. It removes the connection after a communication failure and reconnects on the next operation.
Upload TLS files
Skip this section when the server uses plain TCP.
- Open the file management page for the Socket Client Connector.
- Upload each required PEM file.
- Assign the matching category to each file:
- Certificate: Client certificate.
- Key: Client private key.
- Root CA: Certificate authority used to verify the server.
- Certificate chain: Optional intermediate client certificates sent during mutual TLS.
- Save the files.
See Manage and configure Connector files and certificates for the complete file-management procedure.
Create a Socket Client instance
The Connector does not support instance or item discovery. Configure the connection manually.
- In the sidebar, expand Workspace and select Instances.
- Select Create instance.
- Select the Socket Client TCP/IP Connector.
- Enter a unique name for the instance.
- Enter the server's hostname or IP address in Address.
- Configure the instance parameters described below.
- Create the instance.
| Parameter | Required | Default | Description |
|---|---|---|---|
| Address | Yes | None | Hostname or IPv4 address of the socket server. |
| Port | Yes | 1300 |
TCP port on which the server accepts connections. |
| Timeout | Yes | 2000 |
Timeout in milliseconds for the connection, TLS handshake, and incoming data. |
| Certificate | For mutual TLS | None | Client certificate used to authenticate SIA Connect to the server. Selecting a client certificate enables TLS. |
| Key | With a client certificate | None | Private key that matches the selected client certificate. |
| Root CA | For TLS server verification | None | Certificate authority used to verify the server certificate. Selecting a Root CA enables TLS. |
| Certificate chain | No | None | Optional file containing one or more intermediate client certificates sent to the server during mutual TLS. |
Configure TLS
The selected certificate fields determine whether the Connector uses TLS:
| Connection | Root CA | Certificate | Key | Certificate chain |
|---|---|---|---|---|
| Plain TCP | None | None | None | None |
| TLS with server verification | Required | None | None | None |
| Mutual TLS | Required | Required | Required | Optional |
The Connector requires TLS 1.2 or later and verifies the server certificate whenever TLS is enabled.
Select the Root CA when using a client certificate so the Connector can verify the server. Select the client certificate and its matching key as a pair.
Use the default items
When an instance is created, the Connector adds two enabled items automatically:
- Read socket: A read-only item for receiving messages or sending a request and receiving its reply.
- Write socket: A write-only item for sending mapped values or fixed commands.
Both default items use Plain Text (UTF-8) encoding and Carriage Return + Line Feed as the delimiter. Edit them to match the server protocol.
You can create additional items when the same server connection uses different commands or message formats.
Configure an item
| Parameter | Default | Description |
|---|---|---|
| Command | Empty | Command sent before a read request. For a write item, it is used when the incoming value is empty. |
| Encoding | Plain Text (UTF-8) | Controls how outgoing Command or value text is converted into bytes. Select Hex when the field contains hexadecimal byte pairs. |
| Delimiter | None for manually created items | Character or character sequence appended to outgoing data. For reads, it also marks the end of the incoming message and is removed from the stored value. |
The automatically created Read socket and Write socket items use Carriage Return + Line Feed rather than the item schema default.
Select the encoding
| Encoding | Outgoing behavior | Example |
|---|---|---|
| Plain Text (UTF-8) | Sends the configured text as UTF-8 bytes. | STATUS? |
| Hex | Decodes hexadecimal pairs into bytes before sending. |
5354415455533F sends the bytes for STATUS?. |
Do not add 0x, spaces, or separators to a Hex value unless the server protocol explicitly expects those characters after decoding.
Encoding only changes outgoing data. Incoming bytes are stored as the received value and are not converted into a hexadecimal string when Hex is selected.
Select the delimiter
| Delimiter | Characters |
|---|---|
| None | No delimiter |
| Carriage Return + Line Feed | \r\n |
| Line Feed (Newline) | \n |
| Carriage Return | \r |
| Null Character | \0 |
| Semicolon | ; |
| Comma | , |
| Pipe | | |
| Colon | : |
| Tab | \t |
| Space | A single space |
| Asterisk | * |
| Hash or Pound Sign | # |
| Dollar Sign | $ |
| Percent Sign | % |
| Greater-than Symbol | > |
| Less-than Symbol | < |
For a read item, select the exact delimiter sent at the end of the server response. The Connector waits until the collected data ends with that delimiter, then removes it from the stored value.
Do not use None for a read item. The current Connector requires a non-empty delimiter to complete a read. The Null Character option is also treated as an empty delimiter in this version and is not suitable for reading null-terminated messages.
None can be used for write-only communication when the server expects no trailing delimiter.
Receive unsolicited messages
- Open the Read socket item.
- Leave Command empty.
- Select the server's encoding and delimiter.
- Set the required update interval.
- Save and enable the item.
During each read, the Connector waits for data until Timeout expires. When no command was sent, a timeout is cleared and the connection remains available for the next poll.
The Connector forces each successful reply to be processed, even when it is identical to the previous value.
Send a command and read the reply
- Open the Read socket item.
- Enter the request in Command.
- Select the encoding used by the command.
- Select the delimiter used for both the outgoing request and incoming reply.
- Set the required update interval.
- Save and enable the item.
The Connector appends the delimiter to the command, sends it, and waits for the reply. If the reply is not completed before Timeout, the item reports an error and the connection is closed.
This mode assumes that the request and reply use the same delimiter.
Send values to the socket server
- Open the Write socket item.
- Select the required encoding and delimiter.
- Leave Command empty when a mapping supplies the message.
- Save and enable the item.
- Create a mapping from the source item to the Write socket item.
- Add a template or transformation when the server requires a specific message structure.
- Enable the mapping and generate a new source value.
The Connector sends the mapped value when it is not empty. If the value is empty, it sends Command instead.
See Create and edit mappings for the complete mapping procedure.
Verify the configuration
- Enable the Socket Client instance and required items.
- Confirm that the instance establishes a connection without an error.
- For a read item, send or request a message that ends with the configured delimiter.
- Confirm that the received value appears without the trailing delimiter.
- For a write item, trigger its mapping and confirm that the server receives the expected bytes.
- For TLS, confirm that the server certificate is accepted and mutual authentication succeeds when configured.
Troubleshoot the Socket Client Connector
| Message or symptom | Cause and action |
|---|---|
| Error opening socket | The Connector could not create a local TCP socket. Restart the Connector. If the problem continues, review system resource usage and logs. |
| Error resolving host | The configured hostname could not be resolved. Correct Address, confirm DNS settings, or use the server's IP address. |
| Error connecting to socket or Socket error | The TCP connection failed. Confirm Address, Port, server status, routing, and firewall rules. |
| Timeout connecting to socket | The server did not accept the connection before Timeout expired. Confirm the network path and increase Timeout if the server responds slowly. |
| Failed to load CA file | The selected Root CA could not be opened or parsed. Confirm that the correct PEM file was uploaded and assigned the Root CA category. |
| Failed to load client cert | The selected client certificate is missing, unreadable, or not valid PEM. Upload the correct certificate and select it again. |
| Failed to load client key | The selected private key is missing, unreadable, or not valid PEM. Upload the correct key and select it again. |
| Private key does not match the certificate | The selected key and client certificate are not a pair. Select the matching files. |
| Failed to open chain file or Failed to add chain cert | The certificate chain file could not be opened or one of its certificates could not be loaded. Confirm that it contains the required intermediate certificates in PEM format. |
| Timeout or error during SSL handshake | The TLS negotiation did not complete before Timeout. Check server availability, certificate requirements, protocol compatibility, and network latency. |
| SSL handshake failed | The server certificate could not be verified or the TLS configuration was rejected. Confirm the Root CA, server name, client certificate, key, certificate chain, and TLS requirements. |
| Timeout waiting for data or delimiter | No complete response ended with the selected delimiter before Timeout. Confirm that the server replies, select its exact delimiter, and increase Timeout if required. Do not use None or Null Character for a read item in this version. |
| Connection closed by peer | The server closed the connection. Check whether it permits persistent connections and whether the sent command or message was valid. |
| SSL read error or SSL write error | The encrypted session failed during data transfer. Check the server logs, certificate validity, and whether the server ended the TLS session. |
| Recv error or Send error | The plain TCP connection failed during transfer. Check the server, network stability, and connection lifetime. |
| Select error or timeout for write | The socket did not become writable within the fixed five-second write wait. Check whether the server is accepting data and whether the connection is stalled. |
| The reply includes several messages | More than one delimited message may have arrived before the read completed. Adjust the server so it sends one reply per request or separate the combined value in a mapping. |
| Hex replies are not displayed as hexadecimal | This is expected. Hex converts outgoing input to bytes but does not encode received bytes as hexadecimal text. |
| A write sends Command instead of the mapped value | The incoming mapped value was empty. Clear Command if an empty mapped value must produce an empty message, or adjust the mapping so it always supplies the intended content. |
If a problem continues, see Troubleshoot Connector, instance, item, and mapping errors.