feat: Semaine 9
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#client
|
||||
import socket
|
||||
import threading
|
||||
|
||||
from utils import receive_messages, send_messages
|
||||
|
||||
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
client_socket.connect(("localhost", 9999))
|
||||
|
||||
pseudo = input("Choisissez votre pseudo : ")
|
||||
client_socket.send(pseudo.encode())
|
||||
|
||||
print(f"Connecté au chat en tant que {pseudo} !\n")
|
||||
|
||||
thread_recv = threading.Thread(target=receive_messages, args=(client_socket,))
|
||||
thread_send = threading.Thread(target=send_messages, args=(client_socket,))
|
||||
|
||||
thread_recv.start()
|
||||
thread_send.start()
|
||||
|
||||
thread_recv.join()
|
||||
thread_send.join()
|
||||
|
||||
print("Chat terminé.")
|
||||
Reference in New Issue
Block a user