Trying to send commands (not labels) to Zebra printers using Python.
On page 574 of the documentation it shows:
Here's my code:
mysocket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) host= "192.168.100.245" # verified IP address of Zebra printerport = 9100mysocket.connect((host, port)) name_string= '''"sgd.name":null'''my_string= f'''{{}}{{{name_string}}}'''x = json.dumps(obj=my_string)mysocket.sendall(bytes(x,encoding="utf-8"))data= mysocket.recv(1024)print(data.decode('utf-8'))
The printer responds to pings and other non-JSON Zebra commands sent to it (i.e. mysocket.send(b"~hs")
). However, with the code above I wait for a long time and no response returns from the printer.
Tried multiple variations of the JSON formatting, what should I try next?