 
 #ifdef USE_NETWORK
   char readBuffer[13];
+  char headerBuffer[10];
 #endif
 
 #ifdef USE_STROMBEWUSST_SERVER

{
  connection = server.available();
  // Check for a new connection
  char headerBuffer[10];

  if (connection)
  {
    Serial.println("[server] new client");
    while (connection.connected()) {
      if (connection.available()) {          
        // Get the first couple of bytes
        for (int i=0; i<10; i++)
        {
          headerBuffer[i] = connection.read();
        }
        connection.flush();
        Serial.println(headerBuffer);
        String header = headerBuffer;
        if (header.startsWith("GET / "))
        {
          connection.print(serverHeader("text/html"));
          connection.println("Angelegte Last: ");
          connection.print((int)(storageSum(60*XS1_TIMEFRAME/TIMEFRAME)*1.25*60/XS1_TIMEFRAME));
          connection.println();
        }
        
        if(header.startsWith("GET /json "))
        {
          connection.print(serverHeader("text/json"));
          connection.print(generateJSON());
        }

        delay(1);
        connection.stop();
      }
    }
    Serial.println("[server] client disconnected");
  }      
}
#endif

#ifdef USE_NETWORK
String serverHeader(String contentType)
{
  return
    String("HTTP/1.1 200 OK\r\n")+
    "Content-Type: "+contentType+"\r\n"+
    "Connection: close\r\n\r\n";
}
#endif


}
#endif

int storageSum(unsigned int frames)
{
  int sum = 0;
  int pos = storagePointer;
