ls.close() exit() else: print("A client has connected to the server!") msg_raw = cs.recv(2048) msg = msg_raw.decode() formatted_msg = Server_utils.format_command(msg) formatted_msg = formatted_msg.split(" ") if len(formatted_msg) == 1: command = formatted_msg[0] else: command = formatted_msg[0] argument = formatted_msg[1] # print(argument) if command == "PING": Server_utils.ping() elif command == "GET": Server_utils.get(list_sequences, cs, argument) elif command == "INFO": Server_utils.info(cs, argument) elif command == "COMP": Server_utils.comp(Seq, argument) elif command == "REV": Server_utils.rev(Seq, argument) elif command == "GENE": Server_utils.gene(Seq, argument)
except KeyboardInterrupt: print("Server stopped by the user") ls.close() exit() msg_raw = cs.recv(2048) msg = msg_raw.decode() formatted_msg = Server_utils.format_command(msg) formatted_msg = formatted_msg.split(" ") if len(formatted_msg) == 1: command = formatted_msg[0] else: command = formatted_msg[0] + '"' argument = '"' + formatted_msg[1] if command == '"PING"': Server_utils.ping(cs) elif command == '"GET"': Server_utils.get(list_sequences, cs, argument) elif command == '"INFO"': Server_utils.info(argument, cs) elif command == '"COMP"': Server_utils.comp(argument, cs) elif command == '"REV"': Server_utils.rev(argument, cs) elif command == '"GENE"': Server_utils.gene(argument, cs)
ls.close() exit() msg_raw = cs.recv(2048) msg = msg_raw.decode() formatted_msg = su.format_command(msg) #print(formatted_msg) formatted_msg = formatted_msg.split(' ') if len(formatted_msg) == 1: command = formatted_msg[0] else: command = formatted_msg[0] argument = formatted_msg[1] if command == 'PING': su.ping(cs) elif command == 'GET': su.get(cs, list_sequences, argument) elif command == 'INFO': su.info(cs, argument) elif command == 'COMP': su.comp(cs, argument) elif command == 'REV': su.rev(cs, argument) elif command == 'GENE': su.gene(cs, argument) else: response = 'Not available command.' cs.send(str(response).encode()) cs.close()