AT Commands for TCP/UDP Application
No | Command | Description |
C1801 | AT+CACID | Set TCP/UDP identifier |
C1802 | AT+CASSLCFG | Set SSL certificate and timeout parameters |
C1803 | AT+CAOPEN | Open a TCP/UDP connection |
C1804 | AT+CASERVER | Open a TCP/UDP Server |
C1805 | AT+CASEND | Send data via an established connection |
C1806 | AT+CARECV | Receive data via an established connection |
C1807 | AT+CAACK | Query Send Data Information |
C1808 | AT+CASTATE | Query TCP/UDP Connection State |
C1809 | AT+CACLOSE | Close a TCP/UDP connection |
C1810 | AT+CACFG | Configure transparent transmission parameters |
C1811 | AT+CASWITCH | Switch to transparent transport mode |
C1801 AT+CACID Set TCP/UDP Identifier
T) AT+CACID=? |
+CACID: (range of supported <cid>s)
OK |
Parameters See Write Command |
|
R) AT+CACID? |
[+CACID: <cid>]
OK |
Parameters See Write Command |
|
W) AT+CACID=<cid> |
OK If error is related to ME functionality: +CME ERROR: <err> |
Parameters <cid> TCP/UDP identifier |
|
Parameter Saving Mode | NO_SAVE |
C1802 AT+CASSLCFG Set SSL Certificate And Timeout Parameters
T) AT+CASSLCFG=? |
+CASSLCFG: (range of supported <cid>s),”cacert”,<caname> +CASSLCFG: (range of supported <cid>s),”clientcert”,<certname> +CASSLCFG: (range of supported <cid>s),”psktable”,<pskname> +CASSLCFG: (range of supported <cid>s),”timeout”,(0-65535) +CASSLCFG: (range of supported <cid>s),”ssl”,(0,1) +CASSLCFG: (range of supported <cid>s),”crindex”,(0,5) +CASSLCFG: (range of supported <cid>s),”localport”,(0-65536) +CASSLCFG: (range of supported <cid>s),”protocol”,(0,1)
OK |
Parameters See Write Command |
|
R) AT+CASSLCFG? |
If <cid> has been set by AT+CACID: +CASSLCFG: <cid> cacert:<caname> clientcert:<certname> psktable:<pskname> timeout:<timeout> ssl:<ssl> crindex:<crindex> localport:<localport> protocol:<protocol>
OK If no <cid> has been set by AT+CACID: OK |
Parameter See Write Command |
|
W) AT+CASSLCFG=<cid>, “cacert”,<caname> |
OK If error is related to ME functionality: +CME ERROR: <err> |
Parameters <cid> TCP/UDP identifier, see AT+CACID <caname> Alphanumeric ASCII text string up to 64 characters. Root certificate name that has been configured by AT+CSSLCFG. Note: If the root certificate is empty, module will trust all certificates as default. |
|
AT+CASSLCFG=<cid>, “clientcert”,<certname> |
OK If error is related to ME functionality: +CME ERROR: <err> |
Parameters <cid> see AT+CACID <certname> Alphanumeric ASCII text string up to 64 characters. Client certificate name that has been configured by AT+CSSLCFG. |
|
AT+CASSLCFG=<cid>,“psktable”,<pskname> |
OK If error is related to ME functionality: +CME ERROR: <err> |
Parameters <cid> see AT+CACID <pskname> Alphanumeric ASCII text string up to 64 characters. PSK table name that has been configured by AT+CSSLCFG. File content format is <identity>:<hex string>. |
|
AT+CASSLCFG=<cid>,“ssl”,<sslFlag> |
OK If error is related to ME functionality: +CME ERROR: <err> |
Parameters <cid> see AT+CACID <sslFlag> Interger 0 Not support SSL 1 Support SSL |
|
AT+CASSLCFG=<cid>,“crindex”,<crindex> |
OK If error is related to ME functionality: +CME ERROR: <err> |
Parameters <cid> see AT+CACID <ctxindex> The identifier of SSL configurations, see AT+CSSLCFG. |
|
AT+CASSLCFG=<cid>,“protocol”,<crindex> |
OK If error is related to ME functionality: +CME ERROR: <err> |
Parameters <cid> see AT+CACID <protocol> Interger 0 TCP 1 UDP |
|
Parameter Saving Mode | NO_SAVE |
C1803 AT+CAOPEN Open A TCP/UDP Connection
T) AT+CAOPEN=? |
+CAOPEN: (range of supported <cid>s),<server>,(1-65535)
OK |
Parameters See Write Command |
|
R) AT+CAOPEN? |
If <cid> has been set by AT+CACID: +CAOPEN: <cid>,<conn_type>,<server>,<port>
OK If no <cid> has been set by AT+CACID: OK |
Parameter See Write Command |
|
W) AT+CAOPEN=<cid>[, <conn_type>],<server>, <port> |
If <asyncOpen_enable> not set or set 0. +CAOPEN: <cid>,<result> OK Otherwise OK +CAOPEN: <cid>,<result> If error is related to ME functionality: +CME ERROR: <err> |
Parameters <cid> see AT+CACID <conn_type> String type. Transfer type. IPV4 or IPV6 address can be automatically identified on the client. “TCP” “UDP” <server> Alphanumeric ASCII text string up to 64 characters. Server IP address or host name. <port> Interger. Server port. <result> 0 Success 1 Socket error 2 No memory 3 Connection limit 4 Parameter invalid 6 Invalid IP address 7 Not support the function 12 Can’t bind the port 13 Can’t listen the port 20 Can’t resolv the host 21 Network not active 23 Remote refuse 24 Certificate’s time expired 25 Certificate’s common name does not match 26 Certificate’s common name does not match and time expired 27 Connect failed |
|
Parameter Saving Mode | NO_SAVE |
Reference |
Note After open a connection successfully, if module receives data, it will report “+CADATAIND: <cid>” to remind user to read data. |
C1804 AT+CASERVER Open A TCP/UDP Server
T) AT+CASERVER=? |
+CASERVER: (range of supported <cid>s),(list of supported <conn_type>s),(range of supported <port>s)
OK |
R) AT+CASERVER? |
[+CASERVER: <cid>,<conn_type>,<port>] OK |
W) AT+CASERVER<cid>,<conn_type>,<port> |
+CASERVER: <cid>,<result>
OK If error is related to ME functionality: +CME ERROR: <err> |
Parameter Saving Mode | NO_SAVE |
<cid> | TCP/UDP identifier |
<conn_type> |
Transfer type “TCP” “TCP6” “UDP” “UDP6” |
<port> |
Integer. Server port. |
<result> |
0 Success 1 Socket error 2 No memory 3 Connection limit 4 Parameter invalid 6 Invalid IP address 7 Not support the function 12 Can’t bind the port 13 Can’t listen the port 20 Can’t resolv the host 21 Network not active 23 Remote refuse 24 Certificate’s time expired 25 Certificate’s common name does not match 26 Certificate’s common name does not match and time expired 27 Connect failed error |
NOTE
After a client access, it will report that.
+CANEW: <server_cid>,<client_cid>,<client_ip>,<client_port>
C1805 AT+CASEND Send Data Via An Established Connection
T) AT+CASEND=? |
+CASEND: (range of supported <cid>s),(range of supported <datalen>),(range of supported <inputtime>)
OK |
Parameters See Write Command |
|
W) AT+CASEND=<cid> |
+CASEND: <leftsize>
OK If error is related to ME functionality: +CME ERROR: <err> |
W) AT+CASEND=<cid>,<datalen>[,inputtime] |
+CASEND: <cid>,<datalen> …….. //Input data OK +CASEND: <cid>,<result>,<sendlen> If error is related to ME functionality: +CME ERROR: <err> |
Parameters <cid> see AT+CACID <datalen> Requested number of data bytes to be transmitted <inputtime> Millisecond, should input data during this period or you can’t input data when timeout. <sendlen> Data bytes that has been sent successfully <result> see AT+CAOPEN |
|
Parameter Saving Mode | NO_SAVE |
Reference |
Note Set the input time that input data during this period or you can’t input data when timeout. The default inputtime is 5000ms. |
C1806 AT+CARECV Receive Data Via An Established Connection
T) AT+CARECV=? |
+CARECV: (range of supported <cid>s),(range of supported <readlen>)
OK |
Parameters See Write Command |
|
W) AT+CARECV=<cid>,<readlen> |
+CARECV: <cid>,<recvlen> ……. //output data OK If error is related to ME functionality: +CME ERROR: <err> |
Parameters <cid> see AT+CACID <readlen> Requested number of data bytes to be read <recvlen> Data bytes that has been actually received |
|
Parameter Saving Mode | NO_SAVE |
C1807 AT+CAACK Query Send Data Information
T) AT+CAACK=? |
+CAACK: (range of supported <cid>s)
OK |
W) AT+CAACK=<cid> |
+CAACK: <totalsize>,<unacksize>
OK If error is related to ME functionality: +CME ERROR: <err> |
Parameter Saving Mode | NO_SAVE |
<cid> | TCP/UDP identifier |
<totalsize> | Total size of sent data. |
<unacksize> | The size of unack data |
C1808 AT+CASTATE Query TCP/UDP Connection State
R) AT+CASTATE? |
[+CASTATE: <cid>,<state>] OK |
Unsolicited Result Code |
If the remote connection is disconnected。 +CASTATE: <cid>,<state> |
Parameter Saving Mode | NO_SAVE |
<cid> | TCP/UDP identifier |
<state> |
0 Closed by remote server or internal error 1 Connected to remote server 2 Listening (server mode) |
C1809 AT+CACLOSE Close A TCP/UDP Connection
T) AT+CACLOSE=? |
+CACLOSE: (range of supported <cid>s)
OK |
Parameters See Write Command |
|
W) AT+CACLOSE=<cid> |
OK If error is related to ME functionality: +CME ERROR: <err> |
Parameters <cid> see AT+CACID |
|
Unsolicited Result Code |
If <autoClose_s>=1, this report will be reported when the remote connection is disconnected. +CACLOSE: (range of supported <cid>s) |
Parameter Saving Mode | NO_SAVE |
C1810 AT+CACFG Configure Transparent Transmission Parameters
T) AT+CACFG=? |
+CACFG: “TRANSWAITTM”,(range of supported <wait_timeout>s) +CACFG: “TRANSPKTSIZE”,(range of supported <size>s) +CACFG: “SACK”,(list of supported <sack_enable>s) +CACFG: “MSS”,(range of supported <mss_value>s) +CACFG: “ACKDELAY”,(range of supported <ackDelay_ms>s) +CACFG: “TCPIRT”,(range of supported <tcpIRT_ms>s) +CACFG: “MAXRXT”,(range of supported <tcpMaxRXT_cnt>s) +CACFG: “TCPOT”,(range of supported <tcpOT_ms>s) +CACFG: “KEEPALIVE”,(list of supported<keepalive_enable>s)[,(range of supported <keepalive_idle>s), (range of supported <keepalive_intval>s), (range of supported <keepalive_cnt>s)] +CACFG: “TCP_NODELAY”,(list of supported <tcpNodelay_enable>s) +CACFG: “LINGER”,(list of supported <linger_enable>s)[,(range of supported <linger_ms>s)] +CACFG: “SNDBUF”,(range of supported <sndBuf_size>) +CACFG: “RCVBUF”,(range of supported <rcvBuf_size>) +CACFG: “ATOCLOSE”,(list of supported <autoClose_enable>s) [,(range of supported <autoClose_s>s] +CACFG: “ACCEPTNUM”,(range of supported <acceptMax_num>s) +CACFG: “ASYNCOPEN”,(list of supported <asyncOpen_enable>s) +CACFG: “TIMEOUT”,(range of supported <cid>s),(range of supported <timeout>s) +CACFG: “LOCALPORT”,(range of supported <cid>s),(range of supported <localport>s) +CACFG: “REMOTEADDR”,(range of supported <cid>s), (range of supported <ip address>s),(range of supported <port>s)
OK |
R) AT+CACFG? |
+CACFG: +TRANSWAITTM: <wait_timeout> +TRANSPKTSIZE: <size> [ +CACFG: “SACK”,<sack_enable> +CACFG: “MSS”,<mss_value> +CACFG: “ACKDELAY”,<ackDelay_ms> +CACFG: “TCPIRT”,<tcpIRT_ms> +CACFG: “MAXRXT”,<tcpMaxRXT_cnt>s) +CACFG: “TCPOT”,<tcpOT_ms> +CACFG: “KEEPALIVE”,<keepalive_enable>[<keepalive_idle>,<keepalive_intval>, <keepalive_cnt>] +CACFG: “TCP_NODELAY”,<tcpNodelay_enable> +CACFG: “LINGER”,<linger_enable>[,<linger_ms>] +CACFG: “SNDBUF”,<sndBuf_size> +CACFG: “RCVBUF”,<rcvBuf_size> +CACFG: “ATOCLOSE”,<autoClose_enable>[,<autoClose_s>] +CACFG: “ACCEPTNUM”,<acceptMax_num> +CACFG: “ASYNCOPEN”,<asyncOpen_enable> +TIMEOUT: <cidx>,<timeoutx>… +LOCALPORT: <cidx>,<localportx>… [+REMOTEADDR,<cidx>,<ipadressx>,<portx>… ]]
OK |
W) AT+CACFG=”TRANSWAITTM”,<wait_timeout> |
OK or ERROR |
W) AT+CACFG=”TRANSPKTSIZE”,<size> |
OK or ERROR |
W) AT+CACFG=”SACK”,<sack_enable> |
OK or ERROR |
W) AT+CACFG=”MSS”,<mss_value> |
OK or ERROR |
W) AT+CACFG=”ACKDELAY”,<ackDelay_ms> |
OK or ERROR |
W) AT+CACFG=”TCPIRT”,<tcpIRT_ms> |
OK or ERROR |
W) AT+CACFG=”TCPOT”,<tcpOT_ms> |
OK or ERROR |
W) AT+CACFG=”KEEPALIVE”,keepalive_enable>[<keepalive_idle>,<keepalive_intval>,<keepalive_cnt>] |
OK or ERROR |
W) AT+CACFG=”TCP_NODELAY”,<tcpNodelay_enable> |
OK or ERROR |
W) AT+CACFG=”LINGER”,<linger_enable>[,<linger_ms>] |
OK or ERROR |
W) AT+CACFG=”SNDBUF“,<sndBuf_size> |
OK or ERROR |
W) AT+CACFG=”RCVBUF“,<rcvBuf_size> |
OK or ERROR |
W) AT+CACFG=”ATOCLOSE”,<autoClose_enable>[,<autoClose_s>] |
OK or ERROR |
W) AT+CACFG=”ACCEPTNUM”,<acceptMax_num> |
OK or ERROR |
W) AT+CACFG=”ASYNCOPEN”,(0-1) |
OK or ERROR |
W) AT+CACFG=”TIMEOUT“,<cid>,<timeoutx> |
OK or ERROR |
W) AT+CACFG=”LOCALPORT”,<cid>,<localport> |
OK or ERROR |
W) AT+CACFG=”REMOTEADDR”,<cid>,<ipaddress>,<localport> |
OK or ERROR |
Parameter Saving Mode | NO_SAVE |
C1811 AT+CASWITCH Switch To Transparent Transport Mode
T) AT+CASWITCH=? |
+CASWITCH: (0-1),(0,1)
OK |
R) AT+CASWITCH? |
+CASWITCH: 0,0
OK |
W) AT+CASWITCH=<cid>,<transmode> |
OK or OK
CONNECT … …
OK or ERROR |
Parameters <cid> see AT+CACID <transmode> 0 Non transparent transmission mode 1 Transparent transmission mode |
|
Parameter Saving Mode | NO_SAVE |