Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By DarioG
#87124 Hi, I'm trying to reuse the WiFiTelnetToSerial example code:
//check UART for data
if(Serial.available()){
size_t len = Serial.available();
uint8_t sbuf[len];
Serial.readBytes(sbuf, len);
//push UART data to all connected telnet clients
for(i = 0; i < MAX_SRV_CLIENTS; i++){
if (serverClients[i] && serverClients[i].connected()){
serverClients[i].write(sbuf, len);
delay(1);
}
}


to send a string to a client,

Code: Select allchar msg[10] = "123456789";

  for (i = 0; i < 10; i++) {           
    if (serverClients[i] && serverClients[i].connected()) {
      serverClients[i].write((const uint8_t *) msg, 10);
      delay(1);
    }
  }


But is restarts continuously, someone could tell me what my error is, my sketch?

If I use the origal code I have no problems everything works OK!