N11 V2
AT Command Manual
Copyright © Neoway Technology Co., Ltd
74
10.4 Receiving Data from the Client: +TCPRECV(S)
Description
To receive data from the client
Format
+TCPRECV(S): <n>,<length>,<data><CR>
Parameter
< n>: Socket ID, ranging from 0 to 5
<length>: The length of the data received
<data>: The data received
Add
0x0d 0x0a
to the end of the data. We can identify the end based on <
length
>.
Return Value
See the Example.
Example
+TCPRECV(S): 1,10,1234567899
Socket 1 receives 10-byte data in
char format from the client.
+TCPRECV(S):
0,10,30313233343536373839
Socket 0 receives 10-byte data in
hexadecimal ASCII format.
Remarks
Additional
(s)
makes this command different from the receive mode of the client
mode in format.
10.5 Sending Data to the Client: +TCPSENDS
Description
To send data to the client
Format
AT+TCPSENDS=<socket>[,<length>]<CR>
Parameter
<socket>: The value of
AcceptSocket
, that is, the socket of the module. See the
description of the
AT+TCPLISTEN
command.
<length>: The length of the data to be sent, value ranges from
1
to
4096
, unit: byte.
Return Value
See the Example.
Example
AT+TCPSENDS=0,10
>
OK
+TCPSENDS: 0,10
10-byte data is successfully sent
through socket 0.
AT+TCPSENDS=0,536
>
+TCPSENDS: Buffer not enough,439
536-byte data is sent on socket 0. Fails
to transmit the data because internal
buffer is insufficient.