Problem with recieving delayed data

Hi! I've been having issues with the HTTP protocol for a project. I'm trying to send 5 blocks of data to an ESP32 via Wi-Fi, the problem emerges when I receive with the esp32 updated and outdated data. This is a picture of the Serial port of Arduino showing only one variable.


In red is the expected data, in blue the recieved one.

Any help is gratly appreciated

Code:

#include <WiFi.h>
WiFiServer server(80);

const char* ssid = "SSID";                  //REMPLAZAR POR SSID
const char* password = "PASSWORD";              //REMPLAZAR POR CONTRA
String msj;                                 //STRING QUE GUARDA EL MENSAJE RECIBIDO POR WIFI
                                            //FALTA VARIABLE DE MAGNETOMETRO!
float Giroscopio[2] = {0,0};                //VARIABLE DE POSICION DE GIROSCOPIO DEL DRON // X, Y
float DatosApp[5] = {0,0,0,0,0};                //VARIABLE DE DATOS DE DIRECCION Y POTENCIA DE LA APP
         
void WifiStart(){
  //Serial.print("Conectando a ");
  //Serial.println(ssid);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid,password);
  while(WiFi.status() != WL_CONNECTED){
    delay(500);
    Serial.print(".");
    }
  Serial.println("Direccion IP: ");
  Serial.print(WiFi.localIP());
  server.begin();
}
void clasify(){
  /*/Res?Slider=xx&XGyro=xx&YGyro=xx&0x=xx&0y=xx*/
  String var = "";
  int a = msj.indexOf("Slider=");
  int b = msj.indexOf("&XGyro=");
  for(int i=a+7; i<=b; i++){var += msj[i];}
  DatosApp[0] = var.toFloat();
  var = "";
  a = msj.indexOf("&XGyro=");
  b = msj.indexOf("&YGyro=");
  for(int i=a+7; i<=b; i++){var += msj[i];}
  DatosApp[1] = var.toFloat();
  var = "";
  a = msj.indexOf("&YGyro=");
  b = msj.indexOf("&0x=");
  for(int i=a+7; i<=b; i++){var += msj[i];}
  DatosApp[2] = var.toFloat();
  var = "";
  a = msj.indexOf("&0x=");
  b = msj.indexOf("&0y=");
  for(int i=a+3; i<=b; i++){var += msj[i];}
  DatosApp[3] = var.toFloat();
  var = "";
  a = msj.indexOf("&0y=");
  b = msj.indexOf("\0");
  for(int i=a+3; i<=b; i++){var += msj[i];}
  DatosApp[4] = var.toFloat();
  var = "";
}
void WifiConection(){
  WiFiClient client = server.available();
  //client.println("GET /T HTTP/1.1\n\n")
  client.println("GET /Res?Slider=xx&XGyro=xx&YGyro=xx&0x=xx&0y=xx HTTP/1.1");
  client.println("Host: " + String(WiFi.localIP()));
  client.println("Connection: close");
  client.println();
  msj="";
  while(client.available()){
    char c = client.read();
    msj += c;
    }
    clasify();
}


void setup() {
  Serial.begin(115200);
  WifiStart();        

  
}

void loop() {                    
  WifiConection();                          
  Serial.println(DatosApp[0]);
  delay(20);                             
}

APP.aia (1.4 MB)