From a1203ccb343703ba5ae522254f75b6384a1831a7 Mon Sep 17 00:00:00 2001 From: jerome Date: Mon, 18 Dec 2023 00:02:09 +0100 Subject: =?UTF-8?q?dep=C3=B4t=20initial?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chat_client.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 chat_client.py (limited to 'chat_client.py') 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") -- cgit v1.2.3