Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to use netcat to print to a Netgear PS104,105,110 print server

0 views
Skip to first unread message

Jeff Liebermann

unread,
Mar 21, 2000, 3:00:00 AM3/21/00
to
See:
http://www.cruzio.com/~jeffl/sco/lp/netgear.htm
for detailed instructions on how to setup OSR5 to use Kevin Smith's
"netcat" program to print to a Netgear PS104 series print server.
Comments, criticism, and improvements are always welcome. I also just
did the same thing with an Axix 540 print server and will inscribe
instructions real-soon-now.

Kevin Smith

unread,
Mar 21, 2000, 3:00:00 AM3/21/00
to

I was using netcat, in house, to print to a couple of printers, and at
a customer site, all Axis 540's. When I tried using it to a remote
location over a 56k frame relay and a couple of routers, I was running
into what looked like buffer overflow problems at the printer or the
Axis box (strange but true) with a bunch of lost data.

I switched to the AXIS supplied prossysv and it worked fine. prossysv
uses a custom protocol to talk to the print server. As designed, you
compile in the host and port settings and pass file names as
arguments. It doesn't do stdin. I modified this into a 'proscat'
which takes everything as command line parameters and will read
standard input. This worked great.

I have no idea why the one implementation didn't work. One possibility
is that the Axis box uses rtelnet. I've never looked into the rtelnet
specs and netcat doesn't attempt any kind of protocol so maybe that's
a factor in the one instance I had trouble.

I also implemented Axis's prosd server to emulate a /dev device with
a named pipe on a unixware 7.1 and an OSR 5.0.4. It works like a
champ on unixware and hangs constantly on OSR. Go figure. I replaced
it on OSR with a simple shell script that waits on the named pipe and
invokes proscat and that's working great.

It occurs to me I could modify netcat to use select() and monitor the
tcp connection for data coming back and maybe send that to stdout or
stderr. I don't know if any of the print servers try to send messages
back.

So... Jeff, let me know if you want some of the details/source code.
--
Do two rights make | Kevin Smith, ShadeTree Software, Philadelphia, PA, USA
a libertarian | 001-215-487-3811 shady.com,kevin bbs.cpcn.com,sysop
| dvtug.org,kevins--Deleware Valley Transit Users Group

Jeff Liebermann

unread,
Mar 21, 2000, 3:00:00 AM3/21/00
to
On 21 Mar 2000 13:40:35 -0500, kbs=cu...@shady.com (Kevin Smith) wrote:

>I have no idea why the one implementation didn't work. One possibility
>is that the Axis box uses rtelnet. I've never looked into the rtelnet
>specs and netcat doesn't attempt any kind of protocol so maybe that's
>a factor in the one instance I had trouble.

The latest Axis firmware incantation gives a choice of "Reverse Telent" or
"raw tcp". See:
http://www.cruzio.com/~jeffl/sco/lp/axis2.gif
for the new setup screen. I'll try it both ways and see if I can reproduce
the overflow problem. I have exactly the same problem at a customer's site
when the system gets busy and packets start getting lost. However, they're
running on ancient Axis 540 firmware. Also, the Axis 540+ does HP LaserJet
emulation (ports 9101-9102) and does not have any flow control problems on
the same network.

>I also implemented Axis's prosd server to emulate a /dev device with
>a named pipe on a unixware 7.1 and an OSR 5.0.4. It works like a
>champ on unixware and hangs constantly on OSR. Go figure. I replaced
>it on OSR with a simple shell script that waits on the named pipe and
>invokes proscat and that's working great.

Ummm, I'm using prosd /dev emulation on 3.2v5.0.5 with oss497b (not c) on
yet another system to a pair of Axis 540 servers. It also worked on
3.2v5.0.2 using the same binary. I had a different problem. If two print
jobs arrive at the same time, one just disappears. No hangs. Compiled with
SCO cc, not GCC. I don't have any UW customers to try it. I'll have to do
everything today as the pile of Axis 540 are getting installed tomorrow.

I also tried both prosd and netcat under Red Hat 6.1 (2.2.8). No problems
but I wasn't testing for overflow problems.

>It occurs to me I could modify netcat to use select() and monitor the
>tcp connection for data coming back and maybe send that to stdout or
>stderr. I don't know if any of the print servers try to send messages
>back.

None of the print servers respond with anything from the ports. This is
because I've been beating up on them with various port scanners (nmap, and a
different netcat). I know the ports are there because I can print to them,
but the port scanners don't find them. Methinks nothing comes back.

>So... Jeff, let me know if you want some of the details/source code.

Sure. Yet another project. SCO doesn't seem to be in any hurry to fix
lpr/lpd, I hate HPNP, and I consider netcat to be a worthy project. I don't
have a working C compiler (lack of diskspace) so please include
executeables.


--
Jeff Liebermann 150 Felker St #D Santa Cruz CA 95060
(831)421-6491 pgr (831)426-1240 fax (831)336-2558 home
http://www.cruzio.com/~jeffl WB6SSY
je...@comix.santa-cruz.ca.us je...@cruzio.com

Jeff Liebermann

unread,
Mar 21, 2000, 3:00:00 AM3/21/00
to
On Tue, 21 Mar 2000 02:23:46 -0800, Jeff Liebermann
<je...@comix.santa-cruz.ca.us> wrote:

>See:
> http://www.cruzio.com/~jeffl/sco/lp/netgear.htm
>for detailed instructions on how to setup OSR5 to use Kevin Smith's
>"netcat" program to print to a Netgear PS104 series print server.
>Comments, criticism, and improvements are always welcome. I also just
>did the same thing with an Axix 540 print server and will inscribe
>instructions real-soon-now.

Done. See:
http://www.cruzio.com/~jeffl/sco/lp/axis.htm
for instructions on how to do it with an Axis 540 print server.

Drievel: The Axis 540 has many many many more features than the
Netgear PS104 and is a much better print server for roughly the same
price. However, the PS104 has a built in 10barfT hub and looks much
nicer. Toss a coin.

Simon Hobson

unread,
Mar 25, 2000, 3:00:00 AM3/25/00
to
In article <f8jedso76r47p67og...@4ax.com>,
Jeff Liebermann <je...@comix.santa-cruz.ca.us> wrote:

>See:
> http://www.cruzio.com/~jeffl/sco/lp/netgear.htm
>for detailed instructions on how to setup OSR5 to use Kevin Smith's
>"netcat" program to print to a Netgear PS104 series print server.
>Comments, criticism, and improvements are always welcome. I also just
>did the same thing with an Axix 540 print server and will inscribe
>instructions real-soon-now.

As it happens I've just started using netcat instead of rtelnet to some of
our printers connected to Bay Annex terminal servers. These have a really
crap TCP/IP implementation that doesn't like a new connection opened
without about 5-10 secs of closing the previous connection, thus they
regularly hang if a printer is used heavily ! Using netcat allows me to add
a "sleep 15" statement between closing the connection after a job and
returning control to the spooler to send the next job.

I would realy like to use this (or any other program that provides similar
functionality) to send jobs to networks postscript lasers (various HP,
Xerox, and Minolta models). At present I have to define a 'local' printer
and send the output of the model script to a remote printer defined in
/etc/printcap. Do you have any advice how to achieve this ?

TIA, Simon


Jeff Liebermann

unread,
Mar 25, 2000, 3:00:00 AM3/25/00
to

The BayNetworks Annex terminal server is nothing more than a fancy print
server when used in this manner. The easy and expensive way would be to
install network interfaces (JetDirect, etc) in your various HP, Xerox, and
Minolta printers. When you define a "local" printer on your SCO box, what
you're doing is building a print server out of the OSR5 box. The clients
print to the OSR5 box, the OSR5 box spools the job, the job goes to the
BayNetworks Annex box, where the serial port valiantly tries to send the job
to the printer. My *GUESS* is the reason your Annex is locking up on big
jobs is that you don't have any functional flow control between the serial
port and the serial port on the printer. Use hardware flow control if
possible.

The serial port is also slower than a snail for such things. The best
solution is to use print servers. I'm partial to Axis 540+/560+ print
servers for about $80 to $130 ea. They plug into the parallel port. They
will support all manner of protocols, filters, conversions, languages, etc.
More features than I'll ever need. The various client machines print
directly to the print server, spool their own jobs, and do not involve
either the OSR5 box or the Annex box.

A minor rant on Postscribble and print spooler scripts. Post processing a
job in the print spooler is a bad idea. It's the job of the application
program to format the job for a specific printer. Having *BOTH* the
application and the print spooler mess with the print formatting (cr-lf,
7/8bits, lpi, cpi, etc) will eventually cause problems. The HPLaserJet
print spooler script that comes with OSR5 is very capable and very flexible
in duplicating exactly what the application should be doing in the first
place. With Postscribble, it's wasted as Postscribble requires that
everything be pass thru, no post-formatting at all, no page control, no
nothing, as Postscribble does all that. All you need is a very simple
spooler script.

One reason I like netcat is that I can have it both ways. I can dump output
directly to the printer with:
print_belching_application | netcat -h hostname -p port_number
with no print spooler script. I can also use the stock SCO print spooler
scripts for those lazy applications that leave the formatting to the
operating system, or insist on local printers. I also have a spooler script
inscribed by someone at Digi that handles autodetect PCL/PS printers.

Simon Hobson

unread,
Mar 28, 2000, 3:00:00 AM3/28/00
to
In article <e32qdsofvhvku8kns...@4ax.com>,
Jeff Liebermann <je...@comix.santa-cruz.ca.us> wrote:

>On Sat, 25 Mar 2000 13:06:02 +0000, simon at ccomms dot demon dot co dot uk
>(Simon Hobson) wrote:

>>As it happens I've just started using netcat instead of rtelnet to some of
>>our printers connected to Bay Annex terminal servers. These have a really
>>crap TCP/IP implementation that doesn't like a new connection opened
>>without about 5-10 secs of closing the previous connection, thus they
>>regularly hang if a printer is used heavily ! Using netcat allows me to add
>>a "sleep 15" statement between closing the connection after a job and
>>returning control to the spooler to send the next job.

>The BayNetworks Annex terminal server is nothing more than a fancy print


>server when used in this manner. The easy and expensive way would be to
>install network interfaces (JetDirect, etc) in your various HP, Xerox, and
>Minolta printers. When you define a "local" printer on your SCO box, what
>you're doing is building a print server out of the OSR5 box. The clients
>print to the OSR5 box, the OSR5 box spools the job, the job goes to the
>BayNetworks Annex box, where the serial port valiantly tries to send the job
>to the printer. My *GUESS* is the reason your Annex is locking up on big
>jobs is that you don't have any functional flow control between the serial
>port and the serial port on the printer. Use hardware flow control if
>possible.

Oops, my fault I - talking about two things in one post. The printers
attached to the Annex are all dot matrix printers, not lasers. All jobs for
these originate on the SCO box and are plain text. The handshaking is fine,
I have conclusively demonstrated to the people who are supposed to support
these units that the problem is a crap TCP/IP implementation. The same
problem occurs with terminals, log out of a host and try to log back in
straight away and you get nowt for 1 1/2 minutes while it times out !
Needless to say, I'm not buying any more of them.

Using netcat instead of the rtelnet driver lets me 'work around' the
problem.


>>I would realy like to use this (or any other program that provides similar
>>functionality) to send jobs to networks postscript lasers (various HP,
>>Xerox, and Minolta models). At present I have to define a 'local' printer
>>and send the output of the model script to a remote printer defined in
>>/etc/printcap. Do you have any advice how to achieve this ?

Rather badly put by me, sorry :-( The lasers are already networked, I'm
just trying to find a 'good' way of driving them.

>A minor rant on Postscribble and print spooler scripts. Post processing a
>job in the print spooler is a bad idea. It's the job of the application
>program to format the job for a specific printer. Having *BOTH* the
>application and the print spooler mess with the print formatting (cr-lf,
>7/8bits, lpi, cpi, etc) will eventually cause problems. The HPLaserJet
>print spooler script that comes with OSR5 is very capable and very flexible
>in duplicating exactly what the application should be doing in the first
>place. With Postscribble, it's wasted as Postscribble requires that
>everything be pass thru, no post-formatting at all, no page control, no
>nothing, as Postscribble does all that. All you need is a very simple
>spooler script.

I largely agree, but all our jobs are either text (no formatting in which
case I do a text->ps conversion) or raw (fully formatted by the app). I am
trying to standardise on one 'type' of printer that will work with
EVERYTHING we use and that means postscript lasers. With macs we just plug
em in and they work. With PCs we have to find a way to make the PC talk to
it (I'm playing with Samba for that one), and with our unix apps I can just
filter through a script to convert the plain text to the right size/paper
options. Our main application is the business accounts/sales
processing/manufacturing management/etc system which produces plain text
(ie absolutely NO formatting) jobs for a dot matrix printer (and uses it's
own spooler).

So far I've modified the standard postscript model to allow additional
options , but I still end up putting jobs through the spooler again to get
them to the printer. I can now specify page size (we have some A3
printers), font, font size, horizontal font scaling (condense the print),
lines/page, finishing (eg duplexing, hole punching, stapling, folding). I'm
currently working on being able to specify an EPS image to print on each
page (for printing business forms under the text). Would you like a copy as
a contribution for your site ?


>One reason I like netcat is that I can have it both ways. I can dump output
>directly to the printer with:
> print_belching_application | netcat -h hostname -p port_number
>with no print spooler script.

This I can't get working with the lasers - all have built in ethernet.
Sending to port 515 results in the printer resetting the connection. Do you
know if anyone has compiled any list of what ports (if at all) various
common laser printers will accept jobs on ? Or alternatively, is there a
variant of netcat that will talk enough of the lpr protocol to work with
these printers ?


Simon

NB, the printers concerned are HP LJ 4M+, 5M, 4000N, Xerox N17, and Minolta
Pi6000 (print controller/rip for the Di620 digital copier).


Jeff Liebermann

unread,
Mar 28, 2000, 3:00:00 AM3/28/00
to
On Tue, 28 Mar 2000 11:05:08 +0100, simon at ccomms dot demon dot co dot uk
(Simon Hobson) wrote:

>currently working on being able to specify an EPS image to print on each
>page (for printing business forms under the text). Would you like a copy as
>a contribution for your site ?

No thanks. Plea for mercy. If it ends up on my site, I have to explain how
it works to those that download it. I also just destroyed some of the stuff
on my web pile by copying in the wrong direction (Oops).

>>One reason I like netcat is that I can have it both ways. I can dump output
>>directly to the printer with:
>> print_belching_application | netcat -h hostname -p port_number
>>with no print spooler script.
>
>This I can't get working with the lasers - all have built in ethernet.
>Sending to port 515 results in the printer resetting the connection. Do you
>know if anyone has compiled any list of what ports (if at all) various
>common laser printers will accept jobs on ? Or alternatively, is there a
>variant of netcat that will talk enough of the lpr protocol to work with
>these printers ?

I'll throw together a collection of known printer port numbers and post
them. Meanwhile, try:
http://www.chebucto.ns.ca/~rakerman/port-table.html
http://www.isi.edu/in-notes/iana/assignments/port-numbers
for entertainment value.

HP JetDirect EX3 uses:
LP1=9100, LP2=9101, LP3=9102
Also see:
http://www.sco.com/cgi-bin/ssl_reference?105327

>NB, the printers concerned are HP LJ 4M+, 5M, 4000N, Xerox N17, and Minolta
>Pi6000 (print controller/rip for the Di620 digital copier).

Nice collection. Looks like everything does PostScribble. I don't
understand why you need to tell the print spooler the paper size as there's
a PostScript command that does that.

Jeff Liebermann

unread,
Mar 28, 2000, 3:00:00 AM3/28/00
to
On Tue, 28 Mar 2000 10:21:59 -0800, Jeff Liebermann
<je...@comix.santa-cruz.ca.us> wrote:

>I'll throw together a collection of known printer port numbers and post
>them.

Done. See:
http://www.cruzio.com/~jeffl/sco/lp/printservers.htm
for a list of print servers and my best guess as to their port numbers
for use with netcat. The numbers that are there are probably correct.
However, I'm not sure how many of them are telnet configurable and on
using what port for telnet. If you have some information to add (or
correct), please let me know.


Simon Hobson

unread,
Mar 30, 2000, 3:00:00 AM3/30/00
to
In article <3ed3eso35cq588r0k...@4ax.com>,
Jeff Liebermann <je...@comix.santa-cruz.ca.us> wrote:

>On Tue, 28 Mar 2000 10:21:59 -0800, Jeff Liebermann
><je...@comix.santa-cruz.ca.us> wrote:
>
>>I'll throw together a collection of known printer port numbers and post
>>them.
>
>Done. See:
> http://www.cruzio.com/~jeffl/sco/lp/printservers.htm
>for a list of print servers and my best guess as to their port numbers
>for use with netcat. The numbers that are there are probably correct.

Whoopeeeeeeeeee. Port 9100 works with all of them

>>NB, the printers concerned are HP LJ 4M+, 5M, 4000N, Xerox N17, and Minolta
>>Pi6000 (print controller/rip for the Di620 digital copier).
>

>Nice collection. Looks like everything does PostScribble.

Especially as I sit closest to the Di620 so I get to use the 62ppm copier
with all the finishing goodies - though I havn't found the postscript for
tea making yet ;-)

>I don't
>understand why you need to tell the print spooler the paper size as there's
>a PostScript command that does that.

As this is a filter to convert text to postscript, the filter needs to know
if were not using A4 so it can include the relevant commands in the job. It
also needs to know what size text to use which varies depending on page
size and orientation.

Many, many, many thanks, Simon


an...@tipas.lt

unread,
Mar 31, 2000, 3:00:00 AM3/31/00
to je...@comix.santa-cruz.ca.us
In article <3ed3eso35cq588r0k...@4ax.com>,

je...@comix.santa-cruz.ca.us wrote:
> On Tue, 28 Mar 2000 10:21:59 -0800, Jeff Liebermann
> <je...@comix.santa-cruz.ca.us> wrote:
>
> >I'll throw together a collection of known printer port numbers and
post
> >them.
>
> Done. See:
> http://www.cruzio.com/~jeffl/sco/lp/printservers.htm
> for a list of print servers and my best guess as to their port numbers
> for use with netcat. The numbers that are there are probably correct.
> However, I'm not sure how many of them are telnet configurable and on
> using what port for telnet. If you have some information to add (or
> correct), please let me know.
>
>
Castelle LanPress uses port numbers 3000, 3010, 3030 for parallel
ports and 3020 for serial port. Don't know about telnet.
Look at http://www.castelle.com/support/lanpress/downloads/lpti.tar

Andrey Bondar, SysAdmin,
T.I.P.A.S. Ltd, Lithuania


Sent via Deja.com http://www.deja.com/
Before you buy.

Simon Hobson

unread,
Apr 1, 2000, 3:00:00 AM4/1/00
to
In article <a1o7escdqgbk80vp9...@4ax.com>,
Jeff Liebermann <je...@comix.santa-cruz.ca.us> wrote:

>Could you do me a favour? I couldn't find any useful numbers for the
>Xerox N17 printer on their gaudy web pile. If 9100 works, could you
>also check if you can telnet to port 23 and/or 2002?

Neither works. In amongst the stuff returned by getmany, I found conenction
states for a list of ports, presumably all the ports supported. They are
80, 515, 2000, 2501, and 9100. It tried telnetting to 2000 & 2501 but
didn't get any response.

These printers support admin via a web browser, I does actually work quite
well.


I also tried the HP printers. They all support ports 23, 515, 9099, 9100.
In addition the 4000N support port 80, though connecting to it puts up a
page telling me to go get HP WebJet Admin and giving a URL for it.


>getmany printer_ip public iso
>snmpstat -s printer_ip
>
>If they support SNMP, they should return some interesting info. You
>get a page count or set an alarm to warn you when it runs out of
>paper. It's also nice for checking the firmware version of
>HPJetDirect print servers.

getmany returned about 130k from the N17, mostly piles of mib-n.n.n.... But
I could spot some values that I recognised (even the arp table is in there
!).

I suppose some day I ought to find time to learn about this snmp stuff.

Simon


Jeff Liebermann

unread,
Apr 1, 2000, 3:00:00 AM4/1/00
to
On Sat, 01 Apr 2000 08:31:45 +0100, simon at ccomms dot demon dot co dot uk
(Simon Hobson) wrote:

>Neither works. In amongst the stuff returned by getmany, I found conenction
>states for a list of ports, presumably all the ports supported. They are
>80, 515, 2000, 2501, and 9100. It tried telnetting to 2000 & 2501 but
>didn't get any response.

Duh. I never thought to look in the MIB mess for port number. Thanks for a
VERY valueable clue to making netcat work. Going down the list:
80 Web server
515 LPD/LPR
2000 Parallel 1
2501 Serial 1
9100 HP Compatible Parallel 1

>These printers support admin via a web browser, I does actually work quite
>well.

>I also tried the HP printers. They all support ports 23, 515, 9099, 9100.
>In addition the 4000N support port 80, though connecting to it puts up a
>page telling me to go get HP WebJet Admin and giving a URL for it.

I've never seen 9099 used. I'll see what I can figure out.

>getmany returned about 130k from the N17, mostly piles of mib-n.n.n.... But
>I could spot some values that I recognised (even the arp table is in there
>!).

Well, you need the MIB database for the N17 to make sense out of some of the
OID's (Object Identifiers). That should be somewhere on the Xerox web pile.

>I suppose some day I ought to find time to learn about this snmp stuff.

Yep. I volunteered myself to scribble some stuff on how to configure and
use SNMP with SCO systems. Some-day-soon. See:
http://www.cruzio.com/~jeffl/sco/snmp_install.txt
for some clues. Whenever I have a "problem" with a machine or device
(including printers), I setup monitoring using SNMP. I usually use MRTG
(Multi-Router Traffic Grapher) for the logging or some Perl based kludges
that I threw together for the purpose.

MRTG:
http://mrtg.hdl.com/mrtg.html (USA)
Samples of what can be done with MRTG:
http://mrtg.hdl.com/users.html

0 new messages