More than 2048 bytes to ESP8266

Hello folks, I have been trying to send over 2048 bytes to ESP8266 but I did not succed. I am using AT commands to do that. My last commands was AT+CWMODE=3, AT+CIPMUX=1 and AT+CIPSERVER=1. After I get a client connection and a +IPD response, I want to send over 2048 bytes to ESP-8266 using the AT+CIPSEND command. For any string smaller than 2048 everything works well. The problem now is send over that limit... Any help will be appreciated. Tks

I want to send over 2048 bytes to ESP-8266 using the AT+CIPSEND command.

Where do you intend to store the 2048+ bytes that you want to send?

Well... anywhere. Supose that data is stored in a String xpage. The length is over 2048. Tks

Maybe start showing us your code. And tell us which board you're using?

Bellow is my code. The problem is how to send that webpage to ESP8266 (about 2300 bytes). After the AT+CIPSEND command the ESP8266 issue a ERROR… Thanks

//
// ESP8266 RX/TX conected to Serial1 (pins 0, 1) of Arduino Pro Micro (32U4 processor)
// 

#include <avr/pgmspace.h>
#define DEBUG true

const static char webpage[] PROGMEM = {"<html><head><meta http-equiv=""refresh"" content=""10""; charset=""utf-8""><title>Consumo Certo</title></head><body><table border=""0"" width=""352"" cellspacing=""8"" cellpadding=""8""><tr><td align=""center"" colspan=""2"" bgcolor=""#FFFF99"" height=""55"" bordercolor=""#CCCCCC""><IMG SRC=""data:image/gif;base64,R0lGODlhIAAcALMAAAAAAAD/AKCgoID/gMDAwP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAAgABwAAASxEABCq724ShCCJEUojmQpElwwBKDpvkW3snA9yt1k27g3ZZVbwNTbEATIpLKl6pCKRuBRAOqJeiiji0INWa3Zz+vYijWthbBu2702Z6fN2kR+nkfqcqluH+LlegVKg0hXe4AjVFJHY4ghiouMdI6ChJYCW5QnaZwggYdaeCFlLZ9/oZulo5yNqKyenauZqKqxr7NisrCrtaC5tbDAk6Gqwr2nuTs1anPKw3I/kZHQABEAADs=""></td><td align=""center"" colspan=""4"" bgcolor=""#FFFF99"" height=""55"" bordercolor=""#CCCCCC""><b>ConsumoCerto
Tecnologia em Medicao Ltda</b></td></tr><tr><td colspan=""6""></td></tr><tr><td height=""80"" bgcolor=""#CCFFFF"" colspan=""6""><p align=""center"">litros acumulados neste periodo
<b><font size=""10"" color=""#0000FF"">^0</b></td></tr><tr><td height=""80"" bgcolor=""#FFCCFF"" colspan=""6""><p align=""center"">Indice de fluxo atual
<b><font size=""6"">^1</b></td></tr><tr><td height=""80"" bgcolor=""#CCFF33"" colspan=""6""><p align=""center"">litros por hora atual
<b><font size=""6"">^2</b></td></tr><tr><td bgcolor=""#FFFF99"" align=""center"" height=""44""><p align=""center""><font size=""1"">serie
^3</td><td bgcolor=""#FFFF99"" align=""center"" height=""44""><font size=""1"">ref
^4</td><td bgcolor=""#FFFF99"" align=""center"" height=""44""><font size=""1"">fech
^5</td><td bgcolor=""#FFFF99"" align=""center"" height=""44""><font size=""1"">ciclos
^6</td><td bgcolor=""#FFCCFF"" align=""center"" height=""44""><font size=""1"">maxflu
^7</td><td bgcolor=""#CCFF33"" align=""center"" height=""44""><font size=""1"">maxlth
^8</td></tr><tr><td bgcolor=""#CCFFFF"" align=""center"" colspan=""2"" height=""44""><font size=""1"">ultimo fechamento
^9</td><td bgcolor=""#CCFFFF"" align=""center"" colspan=""2"" height=""44""><font size=""1"">consumo
^:</td><td bgcolor=""#CCFFFF"" align=""center"" height=""44""><font size=""1"">maxflu
^;</td><td bgcolor=""#CCFFFF"" align=""center"" height=""44""><font size=""1"">maxlth
^<</td></tr><tr><td bgcolor=""#FFE2B7"" align=""center"" colspan=""4""><font size=""1"" color=""#000000"">Firmware versão 1.2 - Agua
ID ConsumoCerto: ^?</td><td bgcolor=""#00FF00"" align=""center"" colspan=""2"" height=""82"" rowspan=""2""><a href=""9""><b>Atualizar</a></b></td></tr><tr><td bgcolor=""#DFDFBF"" align=""center"" colspan=""4""><font size=""2"" color=""#000000""><b>^@</b></td></tr></table></body></html>"};

char onebyte;
unsigned int i, tam;
String ipgateway = "192.168.0.1";
String ipnetmask = "255.255.255.0";
String ipnet = "192.168.0.7";
String ssid = "your network";
String password = "password";

String cmdIP = "AT+CIPSTA_DEF=\"" + ipnet + "\",\"" + ipgateway + "\",\"" + ipnetmask + "\"" + "\r\n";
String cmdConexao = "AT+CWJAP_DEF=\"" + ssid + "\",\"" + password + "\"" + "\r\n";


void setup()
{

// ESP8266 reset 
 pinMode(9, OUTPUT);
 digitalWrite(9, LOW);
 delay(20);
 digitalWrite(9, HIGH);
 delay(100);

 Serial.begin(9600);
 Serial1.begin(115200);
 delay(1000);

 Serial.println("Begining...");
 Serial.println("");
 sendData("AT+RST\r\n", 500, DEBUG);
 delay(500);
 sendData("AT+GMR\r\n", 500, DEBUG);
 delay(500);
 sendData(cmdConexao, 3000, DEBUG);
 delay(3000);
 sendData(cmdIP, 500, DEBUG);
 delay(500);
 sendData("AT+CIFSR\r\n", 1000, DEBUG);
 delay(500);
 sendData("AT+CIPMODE=0\r\n", 500, DEBUG);
 delay(500);
 sendData("AT+CIPMUX=1\r\n", 500, DEBUG);
 delay(500);
 sendData("AT+CIPSERVER=1,80\r\n", 500, DEBUG);
 delay(500);

 Serial.println("");
 Serial.print("Webpage length: ");
 Serial.println(sizeof(webpage));
 Serial.println("");
 Serial.println("Ready to receive connections...");
 Serial.println("");
 
}

void loop()
{

 // Check if ESP8266 is sending samething

 if (Serial1.available()) {

    if (Serial1.find("+IPD,"))
    {
     delay(300);

     String cipSend = "AT+CIPSEND\r\n";
     sendData(cipSend, 500, DEBUG);


// Try to send the first part of webpage (2048 bytes):
     Serial.println("");
     Serial.print("First part of webpage: ");
     for (i=0; i<2048; i++){
       onebyte = pgm_read_byte_near(webpage + i);
       sendData(String(onebyte), 0, DEBUG);
       Serial.print(String(onebyte));
     }
     delay(20);

// Try to send the second part of webpage (2048 bytes):
     Serial.println("");
     Serial.print("Second part of webpage: ");
     for (i=0; i<(sizeof(webpage)-2048); i++){
       onebyte = onebyte = pgm_read_byte_near(webpage + i + 2048);
       sendData(String(onebyte), 0, DEBUG);
       Serial.print(String(onebyte));
     }  
     delay(20);

     sendData("+++", 0, DEBUG);
     delay(500);
     String closeCommand = "AT+CIPCLOSE\r\n";
     sendData(closeCommand, 500, DEBUG);
   }
 } 
}
 
String sendData(String command, const int timeout, boolean debug)
{
 // Send data to ESP8266
 String response = "";
 Serial1.print(command);
 if (timeout != 0) {
   long int time = millis();
   while ( (time + timeout) > millis())
   {
     while (Serial1.available())
     {
       // The esp has data so display its output to the serial window
       char c = Serial1.read(); // read the next character.
       response += c;
     }
   }
 }
 if (debug)
 {
   Serial.print(response);
 }
 return response;
}

Send it character-by-character or in chunks of e.g. 128 bytes.

And please edit your post and use code tags:
type
** **[code]** **
before your code
type
** **[/code]** **
after your code

It is exactly what I did… character by character… But the error occurs before, imediatelly after AT+CIPSEND command sending …

I have already fix the problem. Thanks to all for help !!! :)

AntonioTesta: I have already fix the problem. Thanks to all for help !!! :)

Thanks for telling us what the problem was.