For a TCP server, we are called back when a client connects. This is ESP level programming.
In the Arduino model of the world, we are "busy loop" processing. We poll for interesting state changes. For example we poll to see if we are connected and we poll to see if we have a new client connected to us that has data to be read.
These two visions are distinct.
The ESP8266 Arduino libraries provide us with the "illusion" that we are working on an Arduino device and provide skills familiarity with folks already familiar with the Arduino libraries ... however, I'm starting to question that philosophy when writing new ESP apps.
And this is where I'd like to throw some ideas out there ... what if we extended the Arduino libraries available in ESP (eg. WiFi and WifiServer as examples) to provide callback functions when events are detected from the underlying ESP SDK? This would allow existing programs that are "Arduino" flavored to work but would allow new applications to leverage what I believe to be the design intent of the ESP. The implications of this would beneficial to the Arduino ESP community ... I don't think anyone doubts the value of adding new functions and capabilities ... but it would "break" anyone trying to port an Arduino ESP app BACK to the Arduino.
... which brings up the philosophical question. What is the intent of this project?
o Provide the Arduino IDE tooling for ESP programming?
o Provide the Arduino libraries AS-IS for the ESP environment?
o Extend the Arduino libraries for the ESP environment?
o ... others?
I for one would like to see the libraries that are being built that add "value" such as WiFi and WiFiServer be augmented with ESP "flavored" functions. Ideally, I would eliminate the need for "loop()" in my programs and all activity would be handled by events.
Neil