mkr1000 in WiFi101 AP-mode suddently disconnects tcp connection

I need a permanent tcp-connection from a PC to an mkr1000 over WiFi for two directional data transmission. The PC is wireless connected to the mkr1000. The mkr1000 is in access point mode. The TCP connection is created from the PC side.
After a random timespan (about one hour) the mkr1000 suddently seems to close the TCP connection without any reason. The Win7 application crashes. This should not happen, because as far as I know, a TCP connection should only be closed from the side that opened the connection.

My Setup:
PC with Windows 7.
The mkr1000 firmware and the librarys are on the latest release.
The WiFi connection is very good throughout the tested period.

My question:
Is there a bug in my code or in the WiFi101 library?

Here is the simplyfied but running code from both connection ends:
First the arduino code. It is a simple echo server, that returns single bytes send from the PC client.

#include <WiFi101.h>

int wifi_status;
boolean already_connected;
WiFiServer* tcp_server;
char ssid[] = "testserver"; // created AP name
int port = 80;

void setup() {
    Serial.begin(9600);
    wifi_status = WiFi.beginAP(ssid);
    if (wifi_status != WL_AP_LISTENING) {        
        Serial.println("Creating WiFi access point failed");
        while (true);  // don't continue
    }
    WiFi.maxLowPowerMode();
    already_connected = false;
    tcp_server = new WiFiServer(port);
    tcp_server->begin();
}

void check_wifi_status(int *status) {
    if (*status != WiFi.status()) {
        *status = WiFi.status(); // it has changed update the variable
        if (*status == WL_AP_CONNECTED) {
            Serial.println("WiFi connected");
        }
        else if (*status == WL_AP_LISTENING) {
            Serial.println("WiFi listening");
        }
        else {
             Serial.print("WiFi status: ");
             Serial.println(*status);
        }
    }
}

void echo_msg(WiFiClient client) {    
    if (client.available()){
        char msg = client.read();      
        client.write(msg);
    }
}

void loop() {
    check_wifi_status(&wifi_status);
    WiFiClient tcp_client = tcp_server->available();  // listen for incoming clients
    boolean connected = false;
    if (tcp_client) {
        connected = tcp_client.connected();
    }
    if (connected) {
        if (!already_connected) {
            Serial.println("TCP client connected");
            already_connected = true;     
        }
        echo_msg(tcp_client);
    }
    if (!connected && already_connected){        
        Serial.println("TCP client disconnected");
        already_connected = false;
    }
}

Second the PC client code, written in python.
The client permanently sends and receives the echoed bytes.

import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('192.168.1.1', 80))

i = 0
while True:
    msg = (i%256).to_bytes(1, byteorder='little')
    sock.send(msg)
    echo_msg = int.from_bytes(sock.recv(2048), byteorder='little', signed=False)
    print(i, echo_msg)
    i = i+1

Here are the latest lines of the serial output from the mkr1000 after the connection error.
The output suggests, that the mkr1000 closed the TCP connection:

Msg: 29
Msg: 30
Msg: 31
Msg: 32
Msg: 33
Msg: 34
Msg: 35
Msg: 36
TCP client disconnected

And here are the latest lines of the PC python output. It also suggests, that because the mkr1000 closed the TCP connection the PC side timed out while receiving:

163614 30
163615 31
163616 32
163617 33
163618 34
163619 35
Traceback (most recent call last):
File “C:\Program Files\JetBrains\PyCharm 2017.1.2\helpers\pydev\pydevd.py”, line 1585, in
globals = debugger.run(setup[‘file’], None, None, is_module)
File “C:\Program Files\JetBrains\PyCharm 2017.1.2\helpers\pydev\pydevd.py”, line 1015, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File “C:\Program Files\JetBrains\PyCharm 2017.1.2\helpers\pydev_pydev_imps_pydev_execfile.py”, line 18, in execfile
exec(compile(contents+"\n", file, ‘exec’), glob, loc)
File “D:/Schroeder/tcp_connection/test_wifi_ap.py”, line 9, in
echo_msg = int.from_bytes(sock.recv(2048), byteorder=‘little’, signed=False)
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connectio n failed because connected host has failed to respond

Process finished with exit code 1

There was a recent firmware upgrade that fixed an awful lot of connection issues.

Have you done that yet ?

In case you haven't then there is a video here

Would suggest that as a first step.

Thanks,
but as mentioned, the latest firmware and libraries are used.

My apologies but sometimes people say that anyway and It was exceptionally late here (3.00 am)

I have an MKR becoming spare shortly so will push your sketch up to it to check.
I just need to finish some "cloud" tests.