summaryrefslogtreecommitdiff
path: root/chat_client.py
diff options
context:
space:
mode:
Diffstat (limited to 'chat_client.py')
-rw-r--r--chat_client.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/chat_client.py b/chat_client.py
new file mode 100644
index 0000000..0d1d9e8
--- /dev/null
+++ b/chat_client.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+import socket
+
+try:
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.connect(("localhost", 1234)) # adresse ip + port du serveur (tuple))
+ while 1:
+ message= input()
+ s.sendall(message.encode())
+ data=s.recv(1024)
+ print(data.decode())
+except KeyboardInterrupt:
+ s.close()
+finally:
+ print("bye")