EasyManua.ls Logo

Espressif Systems ESP8266EX - 3.1. Instructions on the Use of ESP-LAUNCHER Development Board

Espressif Systems ESP8266EX
41 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
!
3. Sample Codes
󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧printf("ESP8266󰲧TCP󰲧client󰲧task󰲧>󰲧recv󰲧data󰲧%d󰲧bytes!\nESP8266󰲧TCP󰲧client󰲧task󰲧>󰲧
%s\n",󰲧recbytes,󰲧recv_buf);
󰲧󰲧󰲧󰲧}
󰲧󰲧󰲧󰲧free(recv_buf);
󰲧󰲧󰲧󰲧if󰲧(recbytes󰲧<=󰲧0)󰲧{
󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧close(sta_socket);
󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧printf("ESP8266󰲧TCP󰲧client󰲧task󰲧>󰲧read󰲧data󰲧fail!\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:
ESP8266󰲧TCP󰲧client󰲧task󰲧>󰲧socket󰲧ok!
ESP8266󰲧TCP󰲧client󰲧task󰲧>󰲧connect󰲧ok!
ESP8266󰲧TCP󰲧client󰲧task󰲧>󰲧send󰲧success
ESP8266󰲧TCP󰲧client󰲧task󰲧>󰲧recv󰲧data󰲧17󰲧bytes!
ESP8266󰲧TCP󰲧client󰲧task󰲧>󰲧ESP8266󰲧recv󰲧test
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.
Espressif
! /!21 37
2017.05

Other manuals for Espressif Systems ESP8266EX

Related product manuals