Sending data from Server to Client with x2 ESP8266

Hi everyone;

I am trying to send the command P or S from a server to a client. Both, client and server are working with ESP8266.

This is the code I have implemented for my server:

#include <ESP8266WiFi.h>
WiFiServer server(80);
char message[1];
char P;
char S;     
void setup() {
         WiFi.mode(WIFI_AP); 
         WiFi.softAP("DART", "12345678"); //SSID & Pass
         server.begin();

         Serial.begin(9600);
         IPAddress HTTPS_ServerIP= WiFi.softAPIP(); // Obtain the IP of the Server
         Serial.print("Server IP is: "); // Print the IP to the monitor window
         Serial.println(HTTPS_ServerIP);
         int value = LOW;
         
}

void loop() {
   //Check if a client has connected
  WiFiClient client = server.available();
  if (!client) 
  {
    return;
  }

  Serial.println("new client"); 
  while(!client.available())
  {
    delay(1);
  }
   
  message[0]=Serial.read();
    if (message[0]=='P') 
  {
    //Serial.print("This is P");
    //server.write('P');
    client.print(P);
  } 
  
  if (message[0]=='S')
  {
    //Serial.print("This is S");
    //server.write('S');
    client.print(S);
  }
 
  delay(1);       
}

The problem I have with this code is that it gets stuck where it says while(!client.available())

This is my code for me client:

#include <Servo.h>
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
//Instantiate variables and objects 
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
char message[1];
bool paintCommand=false;
ESP8266WiFiMulti WiFiMulti;
WiFiClient client;
char P;
char S;

void setup() 
{
  Serial.begin(9600);
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW); 
  WiFiMulti.addAP("DART","12345678");
  Serial.print("Wait for WiFi...");
  while (WiFiMulti.run() !=WL_CONNECTED)
   {
    Serial.print(".");
    delay(500);
   }
  Serial.println("Connected to wifi");
  digitalWrite(LED_BUILTIN, HIGH); 
  
  servo1.attach(D1);
  servo2.attach(D2); 
  servo3.attach(D3);
  servo4.attach(D4);
  servo1.write(50);
  servo2.write(50);
  servo3.write(50);
  servo4.write(50);
}


void play()
{
  servo1.write(150);
  servo2.write(150);
  servo3.write(150);
  servo4.write(150);
}

void UpdateComms()
{
    if(message[0] == P)
    {
      playCommand = true;
      client.flush();
    }
    if(message[0] == S)
    {
      playCommand = false;
        servo1.write(50);
        servo2.write(50);
        servo3.write(50);
        servo4.write(50);
        client.flush();
    }
}

void loop() {
  while(1)
  {
   message[0]=client.read();
    if(paintCommand)
    {
      play();
    }
    UpdateComms();
}
}

At the beginning it gets connected, but later on I do not know if it is still connected or not. Also, the code is not moving the servos, so there is something wrong...

From the serial monitor of the client I get the following:

Connected to wifi

Soft WDT reset

ctx: cont 
sp: 3ffef390 end: 3ffef570 offset: 01b0

>>>stack>>>
3ffef540:  3fffdad0 00000000 3ffee53c 40201e82  
3ffef550:  3fffdad0 00000000 3ffee53c 40203910  
3ffef560:  feefeffe feefeffe 3ffee550 40100718  
<<<stack<<<
�T����J�Wait for WiFi........Connected to wifi

Soft WDT reset

ctx: cont 
sp: 3ffef380 end: 3ffef570 offset: 01b0

>>>stack>>>
3ffef530:  3ffe8445 3ffee37c 3ffee38a 40203079  
3ffef540:  3fffdad0 00000000 3ffee53c 40201eac  
3ffef550:  3fffdad0 00000000 3ffee53c 40203910  
3ffef560:  feefeffe feefeffe 3ffee550 40100718  
<<<stack<<<
jn�P9�J��Wait for WiFi........

So it is connecting and disconnecting everytime.

What's going on?

Up, I need for a class project due tomorrow...