diff --git a/ai/src/Network/API.py b/ai/src/Network/API.py index 4b81dbd6..87dc5be8 100644 --- a/ai/src/Network/API.py +++ b/ai/src/Network/API.py @@ -90,6 +90,8 @@ def sendData(self, data : str, timeout : int = None): the timeout to wait for the server to be ready to receive data (default is None which means no timeout) """ + if -1 in self.outputs: + return _, write, _ = select.select([], self.outputs, [], timeout) if data[-1] != '\n': @@ -109,6 +111,8 @@ def receiveData(self, timeout : float = None): the timeout to wait for the server to send data (default is None which means no timeout) """ + if -1 in self.inputs: + return None readable, _, _ = select.select(self.inputs, [], [], timeout) for s in readable: if s == self.sock: