I have a HP Laserjet 2550n with integrated print server connected to the local network on 192.168.1.100. Unfortunately, the client "toolbox" software that told you the toner status etc only runs under Windows XP. I have used Wireshark to listen to the communication, using an old XP machine, and would like to write my own little program (prob under python) to receive the xml with all the info about the printer. I have managed to use Putty with a "RAW" connection to 192.168.1.100:9220 to repeat the communication below and receive the XML (I have not attached the whole XML, only the beginning).
I am struggling though where to start this with python. I have used a simple socket client to establish a pipe, and socket.recv sends me the first line (220 JetDirect GGW...). When I socket.send(bytes("TIME 600","UTF-8")) and then try and receive again, the interactive shell "freezes".
I would really appreciate any pointers on how to get python to have the conversation as below with the print server. Many thanks!
220 JetDirect GGW server (version 2.0) ready
SERV HP-DC-WEB
250 96 HP-DC-WEB
TIME 600
200 OK
DEVI
255 MFG:Hewlett-Packard;CMD:PJL,PML,BIDI-ECP,MLC,PCL,POSTSCRIPT,PCLXL;MDL:hp color LaserJet 2550 series;CLS:PRINTER;DES:Hewlett-Packard color LaserJet 2550 series;MEM:MEM=57MB;1284.4DL:4d,4e,1;COMMENT:RES=600x2;
OPEN 96
200 OK
DATA
200 OK
GET /hp/device/info_device_status.xml HTTP/1.1
HOST:localhost:5225
USER-AGENT:hp Proxy/2.5
CONTENT-LENGTH:0HTTP/1.1 200 OK
Server: Virata-EmWeb/R6_0_1
Transfer-Encoding: chunked
Content-Type: text/xml
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache
Pragma: no-cache0000013f
<?xml version="1.0" encoding="UTF-8" ?>...</xml>