TCP/UDP IP testing for M2M Modules


Device manufacturers implement proprietary AT coommand interfaces for TCP/UDP connections. Typical interfaces includes bringing up TCP/UDP connection, setting up TCP configuration, send/receive data to remote server, providing link statistics etc.

TCP/UDP Testing for Huawei Modules
Huawei modules have embedded TCP/UDP stack. This lets us create IP connections which are needed for common applications like connecting to a remote server, email, FTP, HTTP etc.
In the TCP/UDP tab of the AT Command Tester, you can easily test TCP connections.

Huawei TCP UDP

TCP Connection
Up to five TCP or UDP connection links can be setup at a time. First IP initialization uses the APN information to create a network connection. Once the IP is initialized, a successful IP address is avilable. Once the IP is initialized, a connection to a remote server to a specific port can be made.


Checking registration status...

AT+CREG?

+CREG: 2,5,"7CF4","232B521",2

OK
Device is registered and is roaming.

Checking if device is already connected...

AT+CGACT?

+CGACT: 1,1
+CGACT: 15,0

OK
Disconnected profile 1
AT+CGACT=0, 1

OK
Dis-connect is successful

^IPSTATE: 7,0,2
AT+CMEE=1

OK
Attaching to network...
AT+CGATT=1

OK

Initializing the IP connection...
AT^IPINIT="bluevia.movistar.es"

^MODE: 5,7

OK

^MODE: 5,4

Checking initialization status...

AT^IPINIT?

^IPINIT: 1,"10.104.133.125","bluevia.movistar.es","80.58.61.250","80.58.61.254"

OK
The network connection is sucessfully initialized.
IP Address -> "10.104.133.125"
APN -> "bluevia.movistar.es"
Primary DNS Address -> "80.58.61.250"
Secondary DNS Address -> "80.58.61.254"
Opening the TCP connection...

AT^IPOPEN=1,"TCP","www.m2msupport.net",80

OK
AT^IPOPEN?

^IPOPEN: 1,"TCP",39855,"74.124.194.252",80,3,1220

OK
Following connections are opened,

Link ID-> 1
Type->"TCP"
Local Port->39855
Remote IP->"74.124.194.252"
Remote Port->80
SIO Port>3
MSS Port->1220
AT^IPOPEN?

^IPOPEN: 1,"TCP",39855,"74.124.194.252",80,3,1220

OK
Following connections are opened,

Link ID-> 1
Type->"TCP"
Local Port->39855
Remote IP->"74.124.194.252"
Remote Port->80
SIO Port>3
MSS Port->1220
Sending TCP data

How to send data to remote server?
Once an IP connection is established, you can use TCP or UDP to connect to a remote server. You can then send the client data using the AT Command Tester. In the above, example, the device is connected to HTTP port (80) of http://m2msupport.net. It then sends HTTP formatted message to the server over the TCP/IP connection. It gets successful response back from the server which is also a HTTP formatted message. When you input messages in the 'Client Data' text box, please check the appropriate formatting(newline) of the intended application.


AT^IPSEND=1,"
GET /m2msupport/http_get_test.php HTTP/1.1
Host:www.m2msupport.net
Connection:keep-alive


^IPDATA: 1,416,HTTP/1.1 200 OK
Date: Tue, 14 Jan 2014 13:53:50 GMT
Server: Apache/2.2.26 (Unix) mod_ssl/2.2.26 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
X-Powered-By: PHP/5.2.17
Keep-Alive: timeout=3, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8

3a
Sucessful HTTP GET test. Data received from m2msupport.net
0

^IPSEND: 1

OK

^IPSTATE: 1,0,0

 

TCP/UDP Testing for Simcom Modules

TCP/UDP

SIMCOM modules have in-built TCP/UDP stack. AT command tester provides interfaces to test TCP/UDP functions of SIMCOM modules.

AT Command sequence for Simcom TCP function

//Checking registration status...
AT+CREG?

+CREG: 0,5

OK
Device is registered and is roaming.

//Checking if device is already connected...
AT+CGACT?

+CGACT: 1,0
+CGACT: 2,0
+CGACT: 3,0

OK
AT+CMEE=1

OK

//Attaching to network...
AT+CGATT=1

OK

//Setting up APN for TCP connection...
AT+CSTT="bluevia.movistar.es"

OK

//Bring up GPRS Connection...

AT+CIICR

OK

//Get the local IP address
AT+CIFSR

10.0.131.15

//Start TCP connection
AT+CIPSTART="TCP","74.124.194.252","80"

OK

CONNECT OK
TCP connection success

Sending TCP data

//Send data. Below data is HTTP formatted.
AT+CIPSEND

>
GET /m2msupport/http_get_test.php HTTP/1.1
Host:www.m2msupport.net
Connection:keep-alive


SEND OK

//Response from remote server.
HTTP/1.1 200 OK
Date: Mon, 20 Jan 2014 19:44:37 GMT
Server: Apache/2.2.26 (Unix) mod_ssl/2.2.26 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
X-Powered-By: PHP/5.2.17
Keep-Alive: timeout=3, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8

3a
Sucessful HTTP GET test. Data received from m2msupport.net
0

CLOSED
TCP connection is closed by remote server

Keywords: Module , M2M , GPRS , 3G , through AT commands,