Problema con String.indexOf

noter:
Si funciona bien y deja de funcionar pasada una hora, así de primeras se me ocurre que puede ser que el cliente dejé de conectar, o que la memoria se llene.
Pin tu código y te podremos dar alguna idea para encontrar y tal vez corregir el problema.

Gracias por tu respuesta noter. Este es el código completo:

/*
  Web client

 This sketch connects to a website (http://www.google.com)
 using an Arduino Wiznet Ethernet shield.

 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13

 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe, based on work by Adrian McEwen

 */

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(74,125,232,128);  // numeric IP for Google (no DNS)
char server[] = "https://mipaginaweb.com";    // name address for Google (using DNS)
unsigned long lastConnectionTime = 0;             // last time you connected to the server, in milliseconds
const unsigned long postingInterval = 3L * 1000L; // delay between updates, in milliseconds
// the "L" is needed to use long type numbers
String sCode;

// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 0, 177);

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void Conectar(){
   // start the Ethernet connection:
  // give the Ethernet shield a second to initialize:
  delay(1000);
  client.stop();
  //Serial.println("connecting...");

  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    //Serial.println("connected");
    // Make a HTTP request:
    client.println("GET /prueba.php HTTP/1.1");
    client.println("Host: mipaginaweb.com");
    client.println("Connection: close");
    client.println();
    lastConnectionTime = millis();
  } else {
    // if you didn't get a connection to the server:
    //Serial.println("connection failed");
  }
}

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  pinMode(8, OUTPUT);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip);
  }
  Conectar();
}

void loop() {
  // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();
    sCode += c;
    //Serial.print(c);
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
      //Serial.println("disconnecting.");
      client.stop();
      if (sCode != ""){
        int pos_ini=sCode.indexOf("[DATA]");
        if (pos_ini>=0) {
          int pos_fin = sCode.indexOf("[/DATA]",pos_ini);
          if (pos_fin>=0) {
            String sDatos = sCode.substring(pos_ini + 6,pos_fin);
            String sValor = sDatos.substring(8,9);
            if (sValor == "1"){
              digitalWrite(8, HIGH);
            }
            else
            {
              digitalWrite(8, LOW);
            }
          }
        }
        else
        {
          Serial.println("==================================================");
          Serial.println(sCode);
          Serial.println("==================================================");
          Serial.println(pos_ini);
          Serial.println("==================================================");
        }
        sCode = ""; 
      }
  }
  if (millis() - lastConnectionTime > postingInterval) {
    Conectar();
  }
}

Como puedes ver el último else se ejecuta cuando no encuentra [DATA] y me imprime en el monitor tanto el contenido de la variable sCode como el valor de pos_ini y puedo ver que si está [DATA] en la variable y sigue siendo -1 el resultado. No es problema de conexión con la página porque si devuelve todo el código correctamente, tiene que ser problema del arduino. Uso arduino Leonardo.