What is the IPP message to be POSTed to a printer in order to get its attributes and more?

1

I'm working on stm32 and trying to get a printer attributes through TCP, I'm reading the IPP documentation and get to find the right message to send

A client TCP socket is created and is connected to port 631 of my printer address Then a send a message with the Ipp header and I get a response from everything but an HP printer but the response is not as expected according to IPP documentation

In C I send

    /ipp HTTP/1.1\r\nContent-Type: application/ipp\r\n
    User-Agent: Internet Printing Provider\r\n
    Host: 10.34.18.44:631\r\nContent-Length: 117\r\n
    Connection: Keep-Alive\r\nCache-Control: no-cache\r\n\r\n
    \001\001\0\v\0\0\0\v
    \001G\0\022attributes-charset\0\005utf-8H\0
    \eattributes-natural-language\0\005en-usE\0
    \vprinter-uri\0\032http://10.34.18.44:631/ipp\003\020

In C# I send

    string _uri = "10.34.18.44";
    string printeruriValue = _uri + ":631/ipp";
    string content = $"{0x0101}";
    content += $"{0x000A}";
    content += $"{0x00000123}";
    content += $"{0x01}"; 
    content += $"{0x47}{0x0012}attributes-charset{0x0005}utf-8";
    content += $"{0x48}{0x001B}attributes-natural-language{0x0005}en-us";
    content += $"{0x45}{0x000B}printer-uri{0x001A}{printeruriValue}";
    content += $"{0x21}{0x0005}limit{0x0004}{0x00000032}";
    content += $"{0x44}{0x0014}requested-attributes{0x0006}job-id";
    content += $"{0x44}{0x0000}{0x0008}job-name";
    content += $"{0x44}{0x0000}{0x000F}document-format";
    content += $"{0x0003}";

    string message = $"POST {_uri + "/ipp"}  HTTP/1.1\r\n" +
    "Content-Type: application/ipp\r\n" +
    "User-Agent: Internet Printing Provider\r\n" +
    "Host:" + _uri + ":631\r\n" +
    $"Content-Length: {content.Length}\r\n"+
    "Connection: Keep - Alive\r\n" +
    "Cache-Control: no-cache\r\n\r\n"+
    content;

And every time I receive from a not HP printer

    ReceiveCallback close : HTTP/1.1 200 OK
    MIME-Version: 1.0
    Server: JC-SHTTPD/1.17.23
    Connection: close
    Content-Type: application/ipp
    Content-Length: 33
    Accept-Ranges: none

    ????G?attributes-charset??

and from an HP printer a 405 error, command unknown

printing
tcp
protocols
printers
asked on Stack Overflow Aug 14, 2019 by manulateigne • edited Aug 14, 2019 by manulateigne

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0