blob: d857e99744f4f4dd1d3f45b4f29ad434c625dce2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#!/usr/bin/env python3
import socket
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('', 1234)) # toutes les interfaces réseau sur le port 1234
s.listen()
conn,addr = s.accept()
while 1:
data=conn.recv(1024)
print(data.decode())
reponse=input()
conn.sendall(reponse.encode())
except KeyboardInterrupt:
s.close()
finally:
print("bye")
|