diff --git a/src/myftp/client.py b/src/myftp/client.py index 94b739f..1788186 100644 --- a/src/myftp/client.py +++ b/src/myftp/client.py @@ -30,12 +30,11 @@ class UDPClient: self.debug = debug def run(self): + # server cannot be reached, stop the client immediately if not self.pong_received: return - client_socket = None # shutup the variableNotBound warning - while True: try: client_socket = socket(AF_INET, SOCK_DGRAM) @@ -106,7 +105,7 @@ class UDPClient: f"myftp> - {self.mode} - ConnectionRefusedError happened. Please restart the client program, make sure the server is running and/or put a different server name and server port." ) finally: - client_socket.close() + client_socket.close() # type: ignore # ping pong UDP def check_udp_server(self):