printf("ESP8266TCPclienttask>recvdata%dbytes!\nESP8266TCPclienttask>
%s\n",recbytes,recv_buf);
}
free(recv_buf);
if(recbytes<=0){
close(sta_socket);
printf("ESP8266TCPclienttask>readdatafail!\n");
}
4. Compile the application program, generate firmware and download it into the ESP8266
module.
5. Power off the module, and change it to operation mode, then power on the module and
run the program.
Result:
ESP8266TCPclienttask>socketok!
ESP8266TCPclienttask>connectok!
ESP8266TCPclienttask>sendsuccess
ESP8266TCPclienttask>recvdata17bytes!
ESP8266TCPclienttask>ESP8266recvtest
Below is an example showing that the TCP server established at the terminal of network
debugging tool communicates with the ESP8266 successfully.
!
3.3.3. TCP Server
1. Establish a TCP server, and bind it with the local port.