def client(ip, port): # Contacts the metadata server and ask for list of files. # Create socket and connect to meta data server sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: sock.connect((ip, port)) except: exit("Could not connect to Metadata Server. Exiting") # Create list packet and encode it pack = Packet() pack.BuildListPacket() encoded_packet = pack.getEncodedPacket() # Send list packet try: sock.send(encoded_packet) except Exception as e: exit(e) # Recieve the response packet as a byte string and decode it into pack message = b"" while buffer := sock.recv(1024): message += buffer