diff --git a/fifohost2.py b/fifohost2.py new file mode 100644 index 0000000..6cf119f --- /dev/null +++ b/fifohost2.py @@ -0,0 +1,24 @@ +import socket + +HOST = '0.0.0.0' +PORT = 9997 # Choose an available port + +with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server_socket: + server_socket.bind((HOST, PORT)) + server_socket.listen() + + print(f"Server listening on {HOST}:{PORT}") + + connection, address = server_socket.accept() + print(f"Connected by {address}") + + with open('tctl', 'w') as fifo: + while True: + data = connection.recv(1024) + if not data: + break + print(data) + fifo.write(data.decode('utf-8')) + fifo.flush() + + print("Connection closed")