server-rack-led/test-server.py

17 lines
372 B
Python
Raw Normal View History

2022-03-26 19:14:20 +00:00
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)