websocket server update

This commit is contained in:
2024-09-25 16:41:23 +02:00
parent ecee554640
commit 465634e1cd

View File

@@ -1,6 +1,5 @@
import socket
HOST = "127.0.0.1" # Standard loopback interface address (localhost)
PORT = 4024 # Port to listen on (non-privileged ports are > 1023)
@@ -13,9 +12,8 @@ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
conn.sendall(b"hallo")
while True:
data = conn.recv(2048)
conn.sendall(input("Enter message: ").encode())
if (data):
if data:
print("received", repr(data))
conn.sendall(b"message received")
if not data:
break
conn.sendall(data)
break