def huffman(inputfile, outputfile): counts = count_chars(inputfile) tree = build_tree(counts) encoded_data = preserve_tree(tree) + tree.encode_data(inputfile) with open(outputfile, 'wb') as f: f.write(pack_data(encoded_data))
def send(self, client, addr): # TODO should send data from all clients to all the other clients # TODO Use try catch; remove from connections if error # Assuming there's only one server and one client right now logging.info("Start sending data.") while self.sending: client.sendall(utilities.pack_data())
def send(self, client, addr): logging.info("Start sending data.") while self.sending: client.sendall(utilities.pack_data())