GithubHelp home page GithubHelp logo

Comments (2)

khoih-prog avatar khoih-prog commented on May 27, 2024

Thanks for using the library and I'm impressed at the sophisticated ways you spent to try solving the issue.

However, please realize that this is the MCU world, with many limitations, such as board's resources, many new and not totally tested and matured libraries (STM32Ethernet, LwIP, String, etc.), and we can not expect the similar results as you're doing with PCs (for example : sending too large HTML files, etc.)

This file does not have the options to increase the buffer size. Tried going through the various header files referenced but have not been able to find a setting for send buffering.

The actual file, not including the header, sent separately, is about 260000 bytes long.

Same results - output to the client stops after about 104 of the 8000 line transferred.

With these researches and findings, I suspect many issues, spreading across many libraries / STM32 core

  1. Heap Fragmentation when using Arduino String
  2. Some severe bugs in STM32Ethernet / LwIP libraries
  3. Even STM32 core

I don't think I have enough time as well as reach to spend on this and solve the issue. And I believe you already spent lot of time here.

The notorious issue of sending very large via Ethernet / WiFi has been posted many times and you can search by Googling.

I know that you already post an issue on STM32thernet library as well as STM32 forum to ask for help and advice from many good experts (much better than me) there. Problems writing to Client using EthernetWebServer_SSL_STM32 and SdFat libraries

I'd appreciate it if you can update or post a link so that we all (other users and myself) and benefit from what you experience.

I'm sorry I have to close the issue now as this has nothing to do with this library (the issue persists even you don't use this library) and I won't spend time on this. Good Luck.

Best Regards,

from ethernetwebserver_ssl_stm32.

khoih-prog avatar khoih-prog commented on May 27, 2024

I think the issue is your code (dealing with SD, etc), not the SM32Ethernet library. Check

  1. Your code if there is any issue
  2. If there is conflict in using SPI bus (SD card + LAN8742A, etc)

I just have some time to test and it seems OK for writing multiple of 10,000 lines from memory (not SD) and OK, using the following simple code

#define REPLY_HEADER    "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\n\r\n"
#define HTML_DATA_START       "<!DOCTYPE HTML>\r\n"
#define HTML_DATA_BODY        "<h4>Hello World from F767ZI running WebServer!</h4>\r\n"
#define HTML_DATA_END         "</html>\r\n"

void loop()
{
  // listen for incoming clients
  EthernetClient client = server.available();

  if (client)
  {
    Serial.println(F("New client"));
    // an http request ends with a blank line
    bool currentLineIsBlank = true;

    while (client.connected())
    {
      if (client.available())
      {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank)
        {
          Serial.println(F("Sending response"));

          // send a standard http response header
          // use \r\n instead of many println statements to speedup data send
          client.print(REPLY_HEADER);

          client.print(HTML_DATA_START);

#define TOTAL_LINES     10000

          for (uint16_t i = 0; i < TOTAL_LINES; i++)
          {      
            client.print(HTML_DATA_BODY);
            Serial.print("Line # : "); Serial.print(i); Serial.print(" => "); 
            Serial.println(HTML_DATA_BODY);
          }
          
          client.print(HTML_DATA_END);
         
          break;
        }

        if (c == '\n')
        {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r')
        {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(10);

    // close the connection:
    client.stop();
    Serial.println(F("Client disconnected"));
  }
}

and terminal output

Start WebServer on NUCLEO_F767ZI, using LAN8742A Ethernet & STM32Ethernet Library
EthernetWebServer_SSL_STM32 v1.3.0
[ETHERNET_WEBSERVER] Board : NUCLEO_F767ZI , setCsPin: 10
[ETHERNET_WEBSERVER] Default SPI pinout:
[ETHERNET_WEBSERVER] MOSI: 11
[ETHERNET_WEBSERVER] MISO: 12
[ETHERNET_WEBSERVER] SCK: 13
[ETHERNET_WEBSERVER] SS: 10
[ETHERNET_WEBSERVER] =========================
You're connected to the network, IP = 192.168.2.154
New client
GET / HTTP/1.1
Host: 192.168.2.154
Connection: keep-alive
Cache-Control: max-age=0
DNT: 1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Referer: http://192.168.2.154/
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8,vi;q=0.7

Sending response
Line # : 0 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 1 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 2 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 3 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 4 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 5 => <h4>Hello World from F767ZI running WebServer!</h4>

...

Line # : 9989 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 9990 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 9991 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 9992 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 9993 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 9994 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 9995 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 9996 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 9997 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 9998 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 9999 => <h4>Hello World from F767ZI running WebServer!</h4>

Client disconnected
New client
GET /favicon.ico HTTP/1.1
Host: 192.168.2.154
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36
DNT: 1
Accept: image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8
Referer: http://192.168.2.154/
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8,vi;q=0.7

Sending response
Line # : 0 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 1 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 2 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 3 => <h4>Hello World from F767ZI running WebServer!</h4>

...


>Hello World from F767ZI running WebServer!</h4>

Line # : 9996 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 9997 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 9998 => <h4>Hello World from F767ZI running WebServer!</h4>

Line # : 9999 => <h4>Hello World from F767ZI running WebServer!</h4>

Client disconnected

from ethernetwebserver_ssl_stm32.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.