I'm trying to interface my d1 to communicate with my laptop C++ application. Using the serial port is quite simple, but I want to set up communications with wifi using esp8266. Why is this so difficult? If I set the ESP8266 as a server, then the signal is weak and I can't communicate so far. What is the simple solution to just transfer simple data like led, and numbers???
jeffegg2: If I set the ESP8266 as a server, then the signal is weak and I can't communicate so far.
What does that mean? It doesn't matter if it's a client or the server, the signal strength is the same.
You need some kind of networking protocol for communication between the ESP and the C++ application. The protocol you use depends on the application (data rates, format, etc.). The configuration (server/client) depends on the application as well.
Implementing a server in C++ is not easy. A server is a blocking process, so you need to use multiple threads.
My recommendation: If you want a graphical user interface, use HTML+CSS+JS, it has native support for HTTP and WebSockets, for example. If you just want a script, without a GUI, use Node.JS, it's much easier for programming servers and using network protocols than C++.