WIFININA, WifiServer slow serving succesive requests

Dear Community

I am using an Arduino mkr 1010 and WIFININA to host a webserver.

Handling single http requests works fine, however when the web-client (Firefox) loads the page and requests additional ressources (css, images), the WifiServer starts lagging after the first couple of files. Typically 1 to 5 seconds before Firefox receives the responses.
Eventually, after ~10 seconds my server serves 8 files successfully (20kB)

Receiving and handling individual requests takes approximately 40ms. But there appears to be a delay between incoming requests which I have no explanation for.

The function below is called in a tight loop(), so there is no interence from any other part of the program.

#include <WiFiNINA.h>

void Wifi_WaitRequest(WiFiServer &Server) {
  WiFiClient client = Server.available();
  if (!client) return;

  static char sReq[128];    // http request buffer
  memset(sReq, 0, 128);
  while (client.connected()) {
     if (client.available()) {
        if (strlen(sReq) >= 127){
            Wifi_Error(WFCl, 406, http_REQLONG);
        char c = client.read();
        if (c != '\n') 
        else {     
          // request complete
          if (strstr(sReq, "GET ") != sReq) {
            Wifi_Error(client,406, http_NOGETRE);
          else {
            // takes approx. 40ms 
            Wifi_HandleRequest(client, sReq);
      }   // client available
    }   // client connected

I will take a SWAG and guess the server does not have the horsepower and bandwidth to do what you want. If I am not mistaken while processing 1 file it cannot process a second.

By server you mean the wifi adapter of the MKR?
What else would affect the bandwidth if receiving the request and sending the response to the ethernet-stream class takes 40ms?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.