<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Opening sockets to a printer or Printer protocols?? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/opening-sockets-to-a-printer-or-printer-protocols/m-p/2550803#M876420</link>
    <description>Hi,&lt;BR /&gt;I've got a problem with my perl program.&lt;BR /&gt;&lt;BR /&gt;Its supposed to open a socket, send information to the printer (a request for page counts, ect...), and then receive back data.&lt;BR /&gt;&lt;BR /&gt;Currently, I'm not sure Im even using the right protocols, so I was wondering if anyone could tell me how they would do this?&lt;BR /&gt;&lt;BR /&gt;Program:&lt;BR /&gt;1. Open a socket to printer (using tcp currently)&lt;BR /&gt;2. Ask printer a question (how do I do this??)&lt;BR /&gt;3. Read and parse answer.&lt;BR /&gt;4. Print answer in a file.&lt;BR /&gt;5. close socket.&lt;BR /&gt;&lt;BR /&gt;Thanks for any ideas or help,&lt;BR /&gt;Chad</description>
    <pubDate>Tue, 10 Jul 2001 13:52:44 GMT</pubDate>
    <dc:creator>Chad Crosby</dc:creator>
    <dc:date>2001-07-10T13:52:44Z</dc:date>
    <item>
      <title>Opening sockets to a printer or Printer protocols??</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/opening-sockets-to-a-printer-or-printer-protocols/m-p/2550803#M876420</link>
      <description>Hi,&lt;BR /&gt;I've got a problem with my perl program.&lt;BR /&gt;&lt;BR /&gt;Its supposed to open a socket, send information to the printer (a request for page counts, ect...), and then receive back data.&lt;BR /&gt;&lt;BR /&gt;Currently, I'm not sure Im even using the right protocols, so I was wondering if anyone could tell me how they would do this?&lt;BR /&gt;&lt;BR /&gt;Program:&lt;BR /&gt;1. Open a socket to printer (using tcp currently)&lt;BR /&gt;2. Ask printer a question (how do I do this??)&lt;BR /&gt;3. Read and parse answer.&lt;BR /&gt;4. Print answer in a file.&lt;BR /&gt;5. close socket.&lt;BR /&gt;&lt;BR /&gt;Thanks for any ideas or help,&lt;BR /&gt;Chad</description>
      <pubDate>Tue, 10 Jul 2001 13:52:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/opening-sockets-to-a-printer-or-printer-protocols/m-p/2550803#M876420</guid>
      <dc:creator>Chad Crosby</dc:creator>
      <dc:date>2001-07-10T13:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: Opening sockets to a printer or Printer protocols??</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/opening-sockets-to-a-printer-or-printer-protocols/m-p/2550804#M876421</link>
      <description>Well, it depends on what you want to ask the&lt;BR /&gt;printer, and what it's willing to tell you.&lt;BR /&gt;&lt;BR /&gt;These days a lot of printers have built-in web&lt;BR /&gt;servers, so you can communicate with them via&lt;BR /&gt;HTTP.  You can use Perl's LWP::UserAgent and&lt;BR /&gt;HTTP::Request modules to talk to the printer, though&lt;BR /&gt;you'll have to parse the HTML output somehow.&lt;BR /&gt;Maybe there's a module to help you parse it.&lt;BR /&gt;&lt;BR /&gt;use LWP::UserAgent;&lt;BR /&gt;use HTTP::Request;&lt;BR /&gt;$url = 'http://printername"&lt;BR /&gt;$ua = new LWP::UserAgent;&lt;BR /&gt;$req = new HTTP::Request(GET =&amp;gt; $url);&lt;BR /&gt;$res = $ua-&amp;gt;request($req);&lt;BR /&gt;if ($res-&amp;gt;is_success()) {&lt;BR /&gt;    $reply = $res-&amp;gt;content();&lt;BR /&gt;    # do something with $reply&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;If the printer doesn't have a built-in web server,&lt;BR /&gt;you may still be able to talk to it directly using TCP.&lt;BR /&gt;The easiest way is probably to use the TELNET&lt;BR /&gt;protocol.  You can test this by simply typing&lt;BR /&gt;"telnet printername" and seeing what happens.&lt;BR /&gt;If you don't get an error message, type "?" or "h"&lt;BR /&gt;or something to get a help menu.  To exit, you can&lt;BR /&gt;usually type "exit" or CTRL-] followed by "q".&lt;BR /&gt;&lt;BR /&gt;If this works, you can probably use Perl's&lt;BR /&gt;Net::Cmd module to talk to the printer.  I haven't&lt;BR /&gt;tried it, so you're on your own.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Jul 2001 17:14:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/opening-sockets-to-a-printer-or-printer-protocols/m-p/2550804#M876421</guid>
      <dc:creator>Gregory Fruth</dc:creator>
      <dc:date>2001-07-10T17:14:00Z</dc:date>
    </item>
  </channel>
</rss>

