
Chapter 22 – AT Command Examples
Multi-Tech Systems, Inc. CDMA Wireless AT Commands (PN S000294J)
177
TCP Connection, Polled Bi-Directional Data Transfer
AT+CMEE=1
Enable detailed reporting of mobile equipment errors.
OK
AT+WGSS=0
Display TCP connection status.
+WGSS: 0,0,1,0,0,0,0
TCP status, PPPstate “closed”, RxMode “Unsolicited”, All sockets “closed”.
OK
AT+WCRX=0,0
Set TCP receive mode; polled received data.
OK
AT+WGSS=0
Display TCP connection status.
+WGSS: 0,0,0,0,0,0,0
TCP status, PPPstate “closed”, RxMode “Polled”, All sockets “closed”.
OK
AT+WPPP=0
Start a MIP data call and open a PPP session.
OK
+WPPP: 201
Unsolicited response; PPP session startup in progress.
+WPPP: 200
Unsolicited response; PPP session established and available.
AT+WGSS=0
Display TCP connection status.
+WGSS: 0,2,0,0,0,0,0
TCP status, PPPstate “open”, RxMode “Polled”, All sockets “closed”.
OK
AT+WIPC
Display module IP address.
+WIPC: 68.25.209.28
OK
AT+WOSK=0,12,57,125,2,24
Open a TCP socket to IP address 12.57.125.2 port 24.
+WOSK: 0,0
TCP socket zero allocated.
OK
+WSKS: 0,0,1
Unsolicited response; TCP socket zero is open.
AT+WGSS=0
Display TCP connection status.
+WGSS: 0,2,0,2,0,0,0
TCP status, PPPstate “open”, RxMode “Polled”, Socket zero “open”.
OK
AT+WSTX=0,0,5,<cr>HELLO
Send “HELLO” to TCP socket zero.
OK
+WSTX: 0,0,5
Unsolicited response; five bytes transmitted on TCP socket zero.
…
+WSKS: 0,0,2
Unsolicited response; Received data available on socket zero.
AT+WSRX=0,0
Read and clear TCP socket zero data buffer.
+WSRX: 0,0,5:WORLD
Socket zero data “WORLD”.
OK
...
AT+WCSK=0,0
Close TCP socket zero.
OK
+WSKS: 0,0,4
Unsolicited response; TCP socket zero is closed.
AT+WPPP=2
Close the PPP session and end the data call.
OK
+WPPP: 203
Unsolicited response; PPP session shutdown in progress.
+WPPP: 202
Unsolicited response; PPP session closed.
TCP Connection, Unsolicited Received Data
For this example, we’ll assume that TCP socket zero has been previously opened for some other non-related purpose and TCP
“Unsolicited” receive mode is set.
AT+WOSK=0,168,0,0,2,42
Open a TCP socket to IP address 168.0.0.2 port 42.
+WOSK: 0,1
TCP socket one allocated.
OK
+WSKS: 0,1,1
Unsolicited response; TCP socket one is open.
AT+WGSS=0
Display TCP connection status.
+WGSS: 0,2,1,2,2,0,0
TCP status, PPPstate “open”, RxMode “Unsolicited”, Socket zero “open”,
OK
Socket one “open”.
AT+WSTX=0,1,5,<cr>HELLO
Send “HELLO” to TCP socket one.
OK
+WSTX: 0,1,5
Unsolicited response; five bytes transmitted on TCP socket one.
…
+WSRX: 0,1,5:WORLD
Unsolicited response; 5 bytes of data received on TCP socket one.
“WORLD”
AT+WCSK=0,1
Close TCP socket one.
OK
+WSKS: 0,1,4
Unsolicited response; TCP socket one is closed.
AT+WGSS=0
Display TCP connection status.
+WGSS: 0,2,1,2,0,0,0
TCP status, PPPstate “open”, RxMode “Unsolicited”, Socket zero “open”,
OK
Socket one “closed”.