17 lines
372 B
Python
17 lines
372 B
Python
|
import socket
|
||
|
|
||
|
HOST = '0.0.0.0'
|
||
|
PORT = 5760
|
||
|
|
||
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||
|
s.bind((HOST, PORT))
|
||
|
s.listen()
|
||
|
conn, addr = s.accept()
|
||
|
with conn:
|
||
|
print(f"Connected by {addr}")
|
||
|
while True:
|
||
|
data = conn.recv(1024)
|
||
|
if not data:
|
||
|
break
|
||
|
conn.sendall(data)
|
||
|
|