WM620 AT
Command Manual
Copyright © Neoway Technology Co., Ltd
83
9.5 Setting Up TCP Connection: +TCPSETUP
Description
To set up a TCP connection
Format
AT+TCPSETUP=[n],<ip>,<port>[,<recv_mode>]<CR>
Parameter
[n]: Connection number, ranging from 0 to 5
The TE will allocate an idle ID to set up the connection if you do not set the value
of
[n]
.
<ip>: Destination IP address, in
xx.xx.xx.xx
<port>: Destination port ID in decimal ASCII code, ranging from 0 to 65535
<recv_mode>: Data receiving mode. The default value is 0.
0: Indicates that the data is output directly after the socket receives it.
1: Indicates that the data received is saved in the buffer and you can run
+IPNETREAD
to read it when necessary.
Return Value
See the Example.
Example
AT+TCPSETUP=0,10.92.189.131,5500
OK
+TCPSETUP:0,OK
+TCPRECV:0,10,1234567890
The connection to 10.92.189.131,5500
is successfully set up on socket 0.
The received data is displayed directly.
AT+TCPSETUP=1,neowayjsr.oicp.net,6
0002
OK
+TCPSETUP:1,OK
Set
up
a
connection
to
neowayjsr.oicp.net on socket 1.
AT+TCPSETUP=0,58.60.184.213,10405
,1
OK
+TCPSETUP:0,OK
+IPURCREAD:0
AT+IPNETREAD=0,1024
+IPREAD:0,10
1234567890
Set
up
a
connection
to
58.60.184.213,10405 on socket 0.
Socket 0 receives data.
Read data buffered in socket 0.