# server.py # simple listener to an IP port to test the phomemo plugin import socket PORT = 9100 # Port to listen on s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(('', PORT)) s.listen(1) while True: conn, addr = s.accept() print(addr) printer = open('test.json', 'wb') while True: data = conn.recv(91000) print('data received') print('Sending to printer...') printer.write(data) if not data: break printer.close()