diff --git a/MATLAB/+XPlaneConnect/closeUDP.m b/MATLAB/+XPlaneConnect/closeUDP.m index f49dd62..4941ae1 100644 --- a/MATLAB/+XPlaneConnect/closeUDP.m +++ b/MATLAB/+XPlaneConnect/closeUDP.m @@ -22,6 +22,10 @@ socket.close; %% Track open clients global clients; -%TODO: Remove stale clients +for i = 1:length(clients) + if socket == clients(i) + clients = [clients(1:i-1) clients(i+1:length(clients))]; + end +end end \ No newline at end of file