Overview
This guide explains how to configure and verify the operation of up to 10 remote TCP/IP data sockets, enabling connections to multiple remote devices using Siretta’s ZETA range of industrial modems.
| Part Number | Description |
|---|---|
| ZETA-GEP-LTE4 (EU) | Low Power LTE Cat 4 European Modem with GPIO and GNSS |
| ZETA-G-GPRS | Entry Level GPRS Modem with GNSS (GL) |
| ZETA-N2-GPRS | Entry Level GPRS Modem (GL) |
| ZETA-NEP-LTE4 (EU) | Low Power LTE Cat 4 European Modem with GPIO |
| ZETA-NEP-LTEM (GL) | Low Power Global LTE Cat M Modem with GPIO |
| ZETA-NLP-LTE1 (EU) | Ultra Low Power European LTE Cat 1 Modem |
| ZETA-NLP-LTEM (GL) | Ultra Low Power Global LTE Cat M Modem |
| ZETA-N-LTE (EU) | High Performance LTE Cat 4 Modem with GPIO |
| ZETA-NSP-LTE1 (EU) | Low Power European LTE Cat 1 Modem |
This application note provides a guide on configuring and verifying the operation of up to 10 remote TCP/IP data sockets, enabling connections to multiple remote devices using Siretta’s ZETA range of industrial modems.
A TCP/IP data socket, often simply referred to as a socket, is a software endpoint that enables communication between two computers or devices over a TCP/IP network. It is a fundamental component for establishing network connections and data transfer. Sockets are identified by a combination of an IP address and a port number, allowing data to be sent and received over the network between these endpoints.
All configurations are controlled using simple Attention commands. AT commands are a set of instructions used to communicate with and control modems.
Expected Result
At the end of this guide the modem should be capable of configuring and verifying the operation of up to 10 remote TCP/IP data sockets.
Resources used:
Refer to the ZETA-xxP Quick Start Guide, which provides step-by-step instructions for initialising the modem and establishing a connection with Tera Term.
Verify the network registration state by executing the AT command:
AT+CREG?
The modem will respond with one of the following when registered:
| Response | Description |
|---|---|
+CREG: 0,1 |
Registered to a home network |
+CREG: 0,2 |
Not registered, but is currently searching for an operator to register to |
+CREG: 0,3 |
Registration denied |
+CREG: 0,5 |
Registered to a roaming network |
Associate a socket with a Packet Data Protocol (PDP) context using the following AT commands:
AT#SCFG=(1-10),(1-16),(0-1500),(0-65535),(10-1200),(0-264)
AT+CGDCONT=1,"IP","APN Name"
AT#SGACT=1,1,"APN Username","APN Password"
Important Note
Highlighted text refers to parameters that are user specific.
In this instance, APN Name, Username, and Password are variables that would differ from one user to another, depending on their respective SIM card network operator.
In this app note the APN Name "wlapn4.com" along with the username and password "OLANCHAG" are specific to Siretta test SIM’s.
It's worth noting that not all network operators require an APN username and password. In such a case, leave these fields blank.
The command would be:
AT#SGACT=1,1
See commonly used public APN details via the following link:
Common Global APN Settings for M2M Cellular Modems
PDP context profile 1 is the system’s standard default.
To activate it, at least one socket must be associated with it.
Issue the command:
AT#SCFG=
The format of the command response will follow the structure:
<Socket ID>,<PDP Context>,<Packet Size>,<Socket Inactivity Timeout>,<Connection Timeout>,<Data Send Timeout>
To activate a context other than the default, first, associate a different socket to it.
| Socket ID | PDP Context (CID) | Packet Size | Socket Inactivity Timeout | Connection Timeout | Data Send Timeout |
|---|---|---|---|---|---|
| Socket number (1–10) | PDP context (1–16) | Packet size (in bytes) to be used when sending data. Range: 1–1500 bytes Setting 0 = automatically chosen by device. |
If no data is exchanged within this period the connection is closed. Default: 90 seconds Range: 1–65535 seconds Setting 0 = no timeout. |
If a connection cannot be established within this period an error is raised. Default: 600 seconds Range: 10–1200 seconds. |
Data will be transmitted even if the size is less than the maximum packet size, following this time interval. Range: 1–255 deciseconds Default: 50 deciseconds 256 to 264 are preset values covering a range of 10 milliseconds (256) to 90 milliseconds (264). Setting 0 = no timeout. |
| COM3 - Tera Term VT |
¶ File Edit Setup Control Window Help |
|
AT AT+CREG? AT#SCFG=1,1,0,0,600,50 AT+CGDCONT=1,"IP","wlapn4.com" AT#SGACT=1,1,"OLANCHAG","OLANCHAG" |
The results of the #SGACT AT command will yield the fixed IP address assigned by the network operator.
For the SIM used in this app note that is:
10.127.93.4
Verify the socket configurations using AT command:
AT#SCFG?
| COM3 - Tera Term VT |
¶ File Edit Setup Control Window Help |
|
AT#SCFG? #SCFG: 1,1,300,0,600,50 OK |
By default the firewall is enabled and configured to reject all incoming socket connections.
Issue the AT command:
AT#FRWL?
| COM3 - Tera Term VT |
¶ File Edit Setup Control Window Help |
|
AT#FRWL? |
The command response OK indicates that the firewall will not allow any incoming socket connections.
To allow incoming socket connections issue the AT command:
AT#FRWL=1,"X.X.X.X","Y.Y.Y.Y"
Where:
| Parameter | Description |
|---|---|
| X.X.X.X | Permitted incoming IP address |
| Y.Y.Y.Y | Permitted subnet mask |
Typically, an IP address is associated with a default subnet mask determined by its class.
There are three main classes:
For more detailed information refer to:
https://learn.microsoft.com/en-us/troubleshoot/windows-client/networking/tcpip-addressing-and-subnetting
| COM3 - Tera Term VT |
¶ File Edit Setup Control Window Help |
|
AT#FRWL=1,"10.127.93.4","255.255.255.0" |
The allowed incoming IP address is configured as:
10.127.93.4
signifying permission for the specific network address 10.127.93.4.
The allowed subnet mask is configured as:
255.255.255.0
indicating authorisation for any IP within the 10.127.93 subnet.
Only incoming connections from:
10.127.93.1
to
10.127.93.254
will be allowed.
To configure the firewall to allow only one specific IP address the subnet mask should be set to:
255.255.255.255
To disable the firewall completely issue the AT command:
AT#FRWL=1,"0.0.0.0","0.0.0.0"
Important Note
Disabling the firewall completely is not advised if integrating a Siretta modem into an end application. For security purposes the firewall MUST not be disabled on production systems.
To establish an outgoing connection, a listening socket must be created.
It will then be bound to the IP address and a user-selected port number.
The ZETA modem used in this application note provides support for a maximum of 10 sockets total.
The TCP ports can fall within the range:
1 to 65,535
TCP ports are categorised into different types.
These port types help identify and manage network traffic efficiently.
These ports are reserved for system services and well-known protocols.
Registered ports are used by various applications and services that are not part of the well-known category but still require standardisation.
It is worth noting that certain well-known ports may be subject to blocking on certain networks.
Consequently, it is recommended to select port numbers above:
49152
as they are less likely to face restrictions.
For more detailed information refer to:
https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
Issue the AT command:
AT#SL=N,1,(1-65535)
Where:
N
represents a socket number between:
1-10
Examples:
| COM3 - Tera Term VT |
¶ File Edit Setup Control Window Help |
|
AT#SL=1,1,10 AT#SL=2,1,200 AT#SL=3,1,3000 |
Issue the AT command:
AT#SS
This command shows all open sockets.
For checking the status of individual sockets issue:
AT#SS=N
Where:
N
is the socket number.
| COM3 - Tera Term VT |
¶ File Edit Setup Control Window Help |
|
AT#SS #SS: 1,4,10.127.93.4,10 OK |
| COM3 - Tera Term VT |
¶ File Edit Setup Control Window Help |
|
AT#SS=1 #SS: 1,4,10.127.93.4,10 OK |
The format of the command response follows the structure:
<Socket ID>,<State 0-6>,<IP>,<Port Number 1-65535>
| Field | Description |
|---|---|
| Socket ID | Socket number (1–10) |
| State 0–6 |
0 – Socket closed 1 – Socket with an active data transfer connection 2 – Socket suspended 3 – Socket suspended with pending data 4 – Socket listening 5 – Socket with an incoming connection 6 – Socket in opening process |
| IP | The allowed incoming IP address |
| Port Number | The associated port number for the corresponding socket |
Open Tera Term on an internet enabled PC, alternatively, using the same PC open a second Tera Term window.
Configure the terminal as shown below, remembering to replace:
TCP port#
and
Host
with the selected port number and IP address respectively.
Other
under Service.
OK
SRING: N
within the terminal window.
AT#SA=N,1
An OK response will be sent when a connection is successful.
Socket connection N is now established.
| COM3 - Tera Term VT |
¶ File Edit Setup Control Window Help |
|
SRING: 1 AT#SA=1,1 |
AT#SSEND=<Socket ID>
>
Enter any data you wish to send after the bracket.
CTRL+Z
An OK response will be sent if successful.
The data will appear in the second terminal window.
| COM3 - Tera Term VT |
¶ File Edit Setup Control Window Help |
|
SRING: 1 AT#SSEND=1 > Outgoing message to Connection 1!OK |
| 10.127.93.4 - Tera Term VT |
¶ File Edit Setup Control Window Help |
|
Outgoing message to Connection 1! |
Data must first be entered within the terminal window of the remote connection.
Issue the following AT command from the modem to receive data from a remote socket:
AT#SRECV=<Socket ID>,<maxByte>[,<UDPInfo>]
Important Note
Square brackets denote optional parameters.
| Parameter | Description |
|---|---|
| maxByte | Maximum amount of data (in bytes) to be read from the socket |
| UDPInfo | 0 = Disabled 1 = Enabled |
When UDPInfo is enabled, the command response will follow the structure:
#SRECV:<Socket ID>,<remoteIP>,<remotePort>,<recData>,<dataLeft>
Where:
| Field | Description |
|---|---|
| remoteIP | The IP address of the sending host |
| remotePort | The port used by the sending host |
| Socket ID | Socket number (1–10) |
| recData | Received data |
| dataLeft | Remaining bytes in the datagram |
Important Note
If AT#SRECV is issued when there is no data present in the buffer, the command will return an ERROR.
To read:
40 bytes
from socket:
1
issue:
AT#SRECV=1,40
The example below shows:
34 bytes
of data have been read from socket ID 1.
| 10.127.93.4 - Tera Term VT |
¶ File Edit Setup Control Window Help |
|
Incoming message from connection 1! |
| COM3 - Tera Term VT |
¶ File Edit Setup Control Window Help |
|
SRING: 1 AT#SRECV=1,40 |
Issue the AT command:
AT#SI=<Socket ID>
The format of the command response will follow the structure:
<Socket ID>,<Data Sent>,<Data Received>,<Buff_IN>,<Ack_Awaiting>,<Cause>
| Parameter | Description |
|---|---|
| Socket ID | Socket number (1–10) |
| Data Sent | Total amount of data sent (in bytes) since the last time the socket was opened. |
| Data Received | Total amount of data (in bytes) received since the last time the socket was opened. |
| Buff_IN | Total amount of data (in bytes) arriving and currently buffered but not yet read. |
| Ack_Awaiting | Total amount of data (in bytes) sent but not yet acknowledged. |
| Cause |
Socket disconnection cause: 0 = Socket has not yet been closed. 1 = Remote host TCP connection close due to FIN/END: normal remote disconnection decided by the remote application. 2 = Remote host TCP connection close due to RST. 3 = Socket inactivity timeout. 4 = Network deactivation (PDP context deactivation from network). |
| COM3 - Tera Term VT |
¶ File Edit Setup Control Window Help |
|
AT#SI=1 |
| COM3 - Tera Term VT |
¶ File Edit Setup Control Window Help |
|
AT#SI=2 |
For information on all data sockets, issue the AT command:
AT#SI
| COM3 - Tera Term VT |
¶ File Edit Setup Control Window Help |
|
AT#SI #SI: 1,70,0,0,0 OK |
Following the outlined steps leads to the successful establishment of a connection and enables the transmission of data from the host to the receiver.
Expected Result
The modem should now be capable of accepting multiple incoming TCP/IP socket connections, transmitting and receiving data, and monitoring socket activity using the available AT command interface.