[cups.general] Request

Johannes Meixner jsmeix at suse.de
Thu Jun 24 02:03:23 PDT 2010


Hello,

On Jun 23 09:52 Christian wrote (shortened):
> I have a special machine which can not be configured,
> which sends a postscript print job over lan
> by clicking a button normally directly to a printer.
>
> Now I want to grab these postscript jobs by connecting
> the LAN cable to a pc and then receive the postscript data
> there and convert it into a picture or .pdf file.

First you need to find out to which TCP port at the printer
the postscript print job data is sent, see the "socket:..."
examples in "Common Network Printer URIs" at
http://www.cups.org/documentation.php/doc-1.4/network.html
for some usual port numbers.

Then you set up a receiver process which listens at this port
on the PC - probably easiest by using the xinetd as listener
for example something like the following:

I assume the port is 9100.

xinetd uses service name and port according to what
is set in /etc/services in particular for port 9100, see
http://www.iana.org/assignments/port-numbers
-------------------------------------------------------------
pdl-datastream  9100/tcp    Printer PDL Data Stream
-------------------------------------------------------------

I created /etc/xinetd.d/pdl-datastream as follows
(compare /etc/xinetd.d/cups-lpd as an example):
-------------------------------------------------------------
service pdl-datastream
{
         disable     = no
         port        = 9100
         socket_type = stream
         protocol    = tcp
         wait        = no
         user        = lp
         server      = /bin/bash
         server_args = /usr/local/bin/pdl-datastream.sh
}
-------------------------------------------------------------

And /usr/local/bin/pdl-datastream.sh just for a simple test:
-------------------------------------------------------------
#! /bin/bash
cat - >/tmp/pdl-datastream.data || exit 1
exit 0
-------------------------------------------------------------

After (re-)starting xinetd on the PC, I get there:
-------------------------------------------------------------
# netstat -nap | grep 9100
tcp  0  0  0.0.0.0:9100  0.0.0.0:*  LISTEN  ... xinetd 
-------------------------------------------------------------

When I send on another machine "Hello" to port 9100 on the PC
-------------------------------------------------------------
user at other_host$ echo Hello | netcat IP_of_the_PC 9100
-------------------------------------------------------------
I get the data "Hello" on the PC as expected:
-------------------------------------------------------------
# cat /tmp/pdl-datastream.data
Hello
-------------------------------------------------------------

Note that there is no mutual exclusion in this simple example
so that multiple other hosts could send data to port 9100
on the PC at the same time where the xinetd would run
multiple /usr/local/bin/pdl-datastream.sh at the same time
which all write to files with the same /tmp/pdl-datastream.data
name which results chaos data in /tmp/pdl-datastream.data


Kind Regards
Johannes Meixner
-- 
SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
AG Nuernberg, HRB 16746, GF: Markus Rex





More information about the cups mailing list