entry_field.pack(ipadx=1, ipady=6, pady=10)
send_button = tkinter.Button(root,
                             text="Send",
                             command=send,
                             width=15,
                             relief="groove")
send_button.pack(pady=10)

root.protocol("WM_DELETE_WINDOW", on_closing)

# ----SOCKET Part----
HOST = "127.0.0.1"
PORT = 1234
NAME = input('Enter your name: ')
BUFFER_SIZE = 1024
ADDRESS = (HOST, PORT)

CLIENT = socket(AF_INET, SOCK_STREAM)
CLIENT.connect(ADDRESS)
print(Fore.GREEN + 'Conexion establecida...')

public_key_1, private_key_1 = RSA.generateKeys()
msg = str(public_key_1[0]) + '*' + str(public_key_1[1])
CLIENT.send(bytes(msg, "utf8"))
m = CLIENT.recv(BUFFER_SIZE).decode('utf8')
public_key_2 = [int(x) for x in m.split('*')]

receive_thread = Thread(target=receive)
receive_thread.start()
tkinter.mainloop()
Exemple #2
0
entry_field.pack(ipadx=1, ipady=6, pady=10)
send_button = tkinter.Button(root,
                             text="Send",
                             command=send,
                             width=15,
                             relief="groove")
send_button.pack(pady=10)

root.protocol("WM_DELETE_WINDOW", on_closing)

# ----SOCKET Part----
HOST = "127.0.0.1"
PORT = 1234
NAME = input('Enter your name: ')
BUFFER_SIZE = 1024
ADDRESS = (HOST, PORT)

CLIENT = socket(AF_INET, SOCK_STREAM)
CLIENT.connect(ADDRESS)
print(Fore.GREEN + 'Conexion establecida...')

public_key_2, private_key_2 = RSA.generateKeys()
msg = str(public_key_2[0]) + '*' + str(public_key_2[1])
CLIENT.send(bytes(msg, "utf8"))
m = CLIENT.recv(BUFFER_SIZE).decode('utf8')
public_key_1 = [int(x) for x in m.split('*')]

receive_thread = Thread(target=receive)
receive_thread.start()
tkinter.mainloop()