How to check that a client has disconnected from esp8266 server

Hi, I am use a esp8266 and I have this portion of code from a tcp server that allows me to detect that a client has connected, but now I need to detect when a client has disconnected from the server, how can I do that, that I have to increase the code?

void loop(){
  uint8_t i;
  if (server.hasClient()){            //check if there are any new clients
    for(i = 0; i < MAXCLIENTS; i++){
      if (!serverClients[i] || !serverClients[i].connected()){   //find free/disconnected spot
        if(serverClients[i]) 
          serverClients[i].stop();

        serverClients[i] = server.available();
        //Serial.print("New client: "); Serial.print(i);
        continue;
      }
    }
    //no free/disconnected spot so reject
    WiFiClient serverClient = server.available();
    serverClient.stop();
    //Serial.println("No client slot available");
  }

I am having the same issue. I am streaming data to the clients. My problem is..if a client disconnects, there are delays and things seem to lock up.
A reset on server fixes the issue.

If i can detect a client had disconnected, i could sort it.

I have tried server.setNoDelay(true); but this did nothing.

if you have been communicating with a client and then

serverClients[i].connected()

returns false it should indicate a client has disconnected