diff options
| author | jerome <jerome@xlinfo.fr> | 2023-12-18 00:02:09 +0100 |
|---|---|---|
| committer | jerome <jerome@xlinfo.fr> | 2023-12-18 00:02:09 +0100 |
| commit | a1203ccb343703ba5ae522254f75b6384a1831a7 (patch) | |
| tree | c54e1e6cf0da29170419b2fd9880ff6dcea28742 /chat_client.py | |
| download | python-a1203ccb343703ba5ae522254f75b6384a1831a7.tar.gz python-a1203ccb343703ba5ae522254f75b6384a1831a7.zip | |
depĂ´t initial
Diffstat (limited to 'chat_client.py')
| -rw-r--r-- | chat_client.py | 15 |
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") |
