choice = "d " + str(4) conn.send(choice) crypt = Polygram() break else: print("Not a valid choice. ") count = 0 with open("messages1.txt") as f: #Opens file and goes through every line. Appends not encrypted count to keep track. for line in f: if(str(line) =="\n"): continue if(str(line)=="\r\n"): continue count=int(count) count += 1 message = str(crypt.encrypt(str(line))) if(count<10): count="0"+str(count) message = str(count) + (message) conn.send(message.encode('utf-8')) time.sleep(60) #Tells receiver that all messages sent? done = "bac.,!? " #Random message to send conn.send(done) conn.close()