From c5d490750b0ee873fa89c7b2aa91de896260e554 Mon Sep 17 00:00:00 2001 From: Suhayl <838119509@qq.com> Date: Sat, 7 Dec 2019 16:11:27 +0800 Subject: [PATCH] Optimization code Optimization code. Judge the size of the camera data. If the data is abnormal, discard the frame data. --- Code/Server/server.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Code/Server/server.py b/Code/Server/server.py index d865b5d..73ea3bb 100644 --- a/Code/Server/server.py +++ b/Code/Server/server.py @@ -90,11 +90,12 @@ class Server: self.connection.flush() stream.seek(0) b = stream.read() - lengthBin = struct.pack('L', len(b)) + length=len(b) + if length >5120000: + continue + lengthBin = struct.pack('L', length) self.connection.write(lengthBin) self.connection.write(b) - if time.time() - start > 600: - break stream.seek(0) stream.truncate() except :