Yeah, the ESP8266 Arduino support is under development.
The reconnection logic is flaky.
The -9 you’re seeing is EBADF, but that comes from the connect() implementation on top of the low-level lwip API. What happens is that Lwip tcp_connect() call fails.
Bear with us, ESP8266 support will improve soon.
We’ve pushed version 1.0.27 which should fix the connection issue.
However, TLS, OTA and filesystem support are still pending.
Remote control (ability to specify custom functions and call them), MQTT, shadow should work just fine.
Do you have a specific project on ESP8266 or just experimenting?
Thanks! I noticed there was very little talk of ESP8266 support for Arduino.
I am really just evaluating the Mdash platform. We need a managed way of doing firmware OTA for both the ESP32 and ESP8266 and this looks Ideal. Only our rapid prototypes are done on Arduino and this time just happens to be the ESP8266. Support for the ESP-IDF is more important, but this will mainly be the ESP32 however the ESP8266 does get used from time to time.