Copyright © Neoway Technology Co., Ltd
10.4 Receiving Data from the Client: +TCPRECV(S)
To receive data from the client
+TCPRECV(S): <n>,<length>,<data><CR>
< 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>.
+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.
Additional (s) makes this command different from the receive mode of the client
mode in format.
10.5 Sending Data to the Client: +TCPSENDS
To send data to the client
AT+TCPSENDS=<socket>[,<length>]<CR>
<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.
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.