printing - 为了获取其属性等,要发布到打印机的 IPP 消息是什么?
问题描述
我正在努力stm32
并尝试通过 TCP 获取打印机属性,我正在阅读 IPP 文档并找到要发送的正确消息
创建客户端 TCP 套接字并连接到我的打印机地址的端口 631 然后发送一条带有 Ipp 标头的消息,我从除 HP 打印机之外的所有设备中得到响应,但根据 IPP 文档,响应与预期不符
在 CI 发送
/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
在 C# 中我发送
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;
每次我从非 HP 打印机收到
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??
从 HP 打印机出现 405 错误,命令未知
解决方案
推荐阅读
- latex - 未在 toc 中的参考文献后的附录和缺少图形标签
- ios - 在 Swift 4 中使用 KeyEnumerators
- javascript - 我可以将 DOM 节点从 iFrame 移动到父母的正文吗?
- python - NameError:名称“click_entry”未定义(Python)
- gradle - gradle中依赖和依赖之间的区别
- email - 无法在蓝色棱镜中发送电子邮件-POP3/SMTP
- azure - Arm 模板:从暂存槽获取 http 触发器
- google-cloud-platform - 数据流作业失败,输出属性丢失错误
- javascript - 使用 Angularjs 只显示面板的一个元素
- python - ERROR:root:Option --device-model-id 在安装 Google Assistant 期间注册设备实例时需要