Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post request content length is limited to 2048btye #202

Open
developergunny opened this issue Aug 31, 2020 · 3 comments
Open

Post request content length is limited to 2048btye #202

developergunny opened this issue Aug 31, 2020 · 3 comments

Comments

@developergunny
Copy link

developergunny commented Aug 31, 2020

I am working on reading the text in the txt file on the sd card and sending it to the server. If contents do not exceed 2048 bytes, it works normally, but if it exceeds 1btye, the server does not request normal parameters.

The content format is as follows.

contens = "documentJson={"list": [{"s_id" : "1111","day" : "2020-08-31","logtime" : "2020-08-31 23:50:26","hdc1080_Temp" : "125.00","hdc1080_RH" : "100.00","pm2008_PM10GRIMM" : "0.00","pm2008_PM25GRIMM" : "0.00","pm2008_PM100GRIMM" : "0.00","pm2008_PM10TSI" : "0.00","pm2008_PM25TSI" : "0.00","pm2008_PM100TSI" : "0.00","pm2008_Numof03" : "0.00","pm2008_Numof05" : "0.00","pm2008_Numof1" : "0.00","pm2008_Numof25" : "0.00","pm2008_Numof50" : "0.00","pm2008_Numof100" : "0.00","ccs811_eco2" : "0.00","ccs811_etvoc" : "0.00","seeed_NH3" : "-3.00","seeed_CO" : "-3.00","seeed_NO2" : "-3.00","seeed_C3H8" : "-3.00","seeed_C4H10" : "-3.00","seeed_CH4" : "-3.00","seeed_H2" : "-3.00","seeed_C2H5OH" : "-3.00","MQ2_Voltage" : "0.18","MQ2_R0" : "9.66","MQ2_H2" : "0.77","MQ2_LPG" : "0.37","MQ2_CO" : "1.26","MQ2_Alcohol" : "0.52","MQ2_Propane" : "0.50","MQ131_Voltage" : "0.00","MQ131_R0" : "385.40","MQ131_NOx" : "0.00","MQ131_CL2" : "0.20","MQ131_O3" : "0.14","MHZ19_Co2" : "463.00","MHZ19_Temp" : "27.00","MHZ19_Accuracy" : "0.00","ZE08_CH2O" : "45.00","so2_SN" : "2147483648.00","so2_So2" : "512.00","so2_TEMP" : "27.00","so2_RH" : "54.00","so2_RawSensor" : "32991.00","so2_TempDigital" : "27700.00","so2_RHDigital" : "31558.00"},{"list": {"s_id" : "1111","day" : "2020-08-31","logtime" : "2020-08-31 23:50:26","hdc1080_Temp" : "125.00","hdc1080_RH" : "100.00","pm2008_PM10GRIMM" : "0.00","pm2008_PM25GRIMM" : "0.00","pm2008_PM100GRIMM" : "0.00","pm2008_PM10TSI" : "0.00","pm2008_PM25TSI" : "0.00","pm2008_PM100TSI" : "0.00","pm2008_Numof03" : "0.00","pm2008_Numof05" : "0.00","pm2008_Numof1" : "0.00","pm2008_Numof25" : "0.00","pm2008_Numof50" : "0.00","pm2008_Numof100" : "0.00","ccs811_eco2" : "0.00","ccs811_etvoc" : "0.00","seeed_NH3" : "-3.00","seeed_CO" : "-3.00","seeed_NO2" : "-3.00","seeed_C3H8" : "-3.00","seeed_C4H10" : "-3.00","seeed_CH4" : "-3.00","seeed_H2" : "-3.00","seeed_C2H5OH" : "-3.00","MQ2_Voltage" : "0.18","MQ2_R0" : "9.66","MQ2_H2" : "0.77","MQ2_LPG" : "0.37","MQ2_CO" : "1.26","MQ2_Alcohol" : "0.52","MQ2_Propane" : "0.50","MQ131_Voltage" : "0.00","MQ131_R0" : "385.40","MQ131_NOx" : "0.00","MQ131_CL2" : "0.20","MQ131_O3" : "0.14","MHZ19_Co2" : "463.00","MHZ19_Temp" : "27.00","MHZ19_Accuracy" : "0.00","ZE08_CH2O" : "45.00","so2_SN" : "2147483648.00","so2_So2" : "512.00","so2_TEMP" : "27.00","so2_RH" : "54.00","so2_RawSensor" : "32991.00","so2_TempDigital" : "27700.00","so2_RHDigital" : "31558.00"}]}";

    if (client.connect((const char*)SERVER.c_str(), 80)) {
        delay(500);
        
        _serial_out->print("Connected to server -> ");
        _serial_out->println(SERVER);

        _serial_out->println(String(contents.length()));
        
        // Make a HTTP request
        client.println("POST /* url */ HTTP/1.1");
        client.println("Host:  /* server */");
        client.println("Content-Length: " + String(contents.length()));
        client.println("Content-Type: application/x-www-form-urlencoded");
        //client.println("Connection: close");
        client.println();

        client.println(contents);

        client.flush();
        client.stop();

        _serial_out->println();
        
        delay(500);

    }else{
        _serial_out->println("Error : Fail connected to server");

        _serial_out->println();
        
        delay(500);
    }
@developergunny
Copy link
Author

image

@JAndrassy
Copy link

the AT firmware has a limit of 2048 bytes per AT+CIPSEND. send it with multiple print commands.
or update the AT firmware and use my WiFiEspAT library. https://github.com/jandrassy/WiFiEspAT
it has a special command for efficient sending of a file.

@developergunny
Copy link
Author

developergunny commented Aug 31, 2020

the AT firmware has a limit of 2048 bytes per AT+CIPSEND. send it with multiple print commands.
or update the AT firmware and use my WiFiEspAT library. https://github.com/jandrassy/WiFiEspAT
it has a special command for efficient sending of a file.

Can I just use the library? Are there any special codes that can be used to send more length parameters?

If there is no other way of limiting the length, just split the text as per your advice. Thank you for answer😊👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants