-->
Page 1 of 1

ESP-1 Web server don't send complete web page.

PostPosted: Thu Apr 21, 2016 5:09 am
by al9
Hi.

My web server on ESP88266-1 with arduino works fine, but if html web page is big (2800bytes) they stopped after end.

Code: Select all// *************** webserver *******************

void webserver() {
  int linea = 0;
  char ch;
  int n;


  // listen for incoming clients
  WiFiClient client = server.available();  //Creamos un cliente Web
  if (!client) return;

  delay(100);

  // Wait until the client sends some data
  n=0;
  while (!client.available()) {
    delay(5);
    if (n++>400) {
      //Serial.print("**timeout;** ");
      return;}
  }
  //server.setNoDelay(true); ????
 
  // Read the first line of the request
  String req = client.readStringUntil('\r');
 
          int posicion = req.indexOf("EDIT="); //Guardamos la posiciĆ³n de la instancia "EDIT=" a la variable 'posicion'

          if (req.substring(posicion) == "EDIT=0") {          selected = 0;        }
          else if (req.substring(posicion) == "EDIT=1") {          selected = 1;        }

 


  // Match the request
  String ret = "";

    if (req.endsWith("HTTP/1.1") && req.startsWith("GET")) {
 

    ret = html1 + String(WiFi.SSID()) + " RSSI:" + String(WiFi.RSSI()) + " dBm <br> IP Add:  " + WiFi.localIP().toString() + " IT:" + String(iteraccion) + "<br>\n";

    ret = ret + table + TSlines + htmlEND ;
    //Envio de la WEB
    client.print(ret);

  }

  // give the web browser time to receive the data
  delay(2);

  // close the connection:
  client.stop();