WiFiClient does not work as supposed

I connect my arduino mkr1000 to my PC over WiFi.
The Arduino works as a WiFi access point.
The communication runs over TCP.

The data exchange runs in a tight loop after the client connects.
The loop should only be left if the TCP client disconnects.
But somehow this does not work.
After some bytes arrive from the client
client.available() stays true. and client.read() as well as client.write()
work without crash but does nothing. The internal TCP buffer does not get flushed.
Here is the arduino code:

#include <WiFi101.h>

char ssid[] = "wifi101-network";
WiFiServer server(80);

void setup() {
    WiFi.beginAP(ssid);
    server.begin();
}

void loop() {    
    WiFiClient client = server.available();
    if (client && client.connected()){        
        
        while (client.connected()) {
            if (client.available()){  // seems not to work
                client.read(read_buffer, read_size);
                client.write(write_buffer, write_size);
            }

        }        
        
        client.stop();
    }
}

After a change in loop() the code works.
But every time between the data exchange
a WiFi client has to be created.
Is this a intensional beheaviour?
And is this a performance or more critical a long term issue?
Here is the working arduino code:

void loop() {    
    WiFiClient client = server.available();
    if (client && client.connected()){                        
        if (client.available()){  
            client.read(read_buffer, read_size);
            client.write(write_buffer, write_size);
        }                 
    }
}

The first code refers to tcp_client, for which I see no declaration. What is tcp_client, and where is it defined?

It also refers to read_buffer, read_size, write_buffer, and write_size which don't appear to be defined.

But every time between the data exchange
a WiFi client has to be created.

I don't understand this statement. A client isn't created. A client is "created" when an outside entity (such as a web browser) connects to the server AND issues a GET request. The server is simply making available the information that a client connected, and returning a handle to the client, so that it's request can be responded to.