ESP8266 works in staTIon mode, you need to confirm that ESP8266 is connected to AP (router) and assigned to IP address, enable client connection
ESP8266 works in soft-AP mode, you need to confirm that the device connected to ESP8266 has been assigned to the IP address, enable client connection.
ESP8266 TCP Client Mode Configuration Process
Program implementation content:1. In staTIon mode, ESP8266 acts as a client and server for TCP connection.
2. Realize the transmission and reception of data (simultaneous return)
Implementation ideas:
The TCP network communication layer is: application layer, network layer, data link layer, physical layer;
1. Set the ESP8266 to the staTIon mode and connect to the AP at the data link layer to obtain an IP address.
2. Make a TCP connection at the network layer: connect to the remote server as a client, and listen to the remote client information as a server;
data link layer:
1. Set ESP8266 to staTIon mode: wifi_set_opmode(STATION_MODE);
2. Configure the parameters related to the AP. In this step, you need to know the AP name ( ssid ) and password ( password ): In the official SDK, after the configuration is executed, the wifi module automatically connects with the AP.
To ensure that the ESP8266 has established a stable connection with the AP and has obtained an IP address, the callback function of the event can be registered to determine:
1. Register callback function
2. Register the timer and determine the flag_sta_conip in the callback function to determine if the IP address has been obtained.
Network layer:
1. Check if ESP8266 has established a stable connection with the AP. If yes, start to establish a TCP client connection:
Establish a TCP client connection (in this setup, you need to know the IP address and port number of the remote server), and register the callback function for connecting and sending data:
2. ESP8266 starts the server service (in this step, by determining the return value of the espconn_accept() function, TRUE turns off the timer that sets the server to be turned on, and FALSE continues to be turned on until the startup is successful)
Callback function to receive data:
Callback function for sending data:
Achieve the effect:
Automotive Diagnostic Connectors And Cables
We make OBD connector with terminal by ourselves, soldering type and crimping type are both available. Such as 16pin obd connector. OBD1, OB2, J1939, J1708, J1962, etc. Also molded by different type, straight type or right-angle type. The OBD connector cables used for Audi, Honda, Toyota, BWM, etc. We have wide range of materials source , also we can support customers to make a customized one to replace the original ones.
Automotive Diagnostic Connectors And Cables,Obd Connectors,Reliable OBD Connector,Black OBD Connector,OBD Diagnostic Cable,OBD2 Connectors
ETOP WIREHARNESS LIMITED , https://www.etopwireharness.com