Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need simple print server script

Status
Not open for further replies.

heyewe

Technical User
Feb 21, 2002
7
NZ
I need a simple script that will accept a TCP socket connection and transfer the output to a virtual printer device i've set up. The app I have won't talk to the virtual printer I set up - it seems to only want character (crw.rw.rw) type devices. The app will happily send to a socket, either local or remote. It doesn't use the print manager to send print jobs, and I want it to so I can print to files and email as well as print.
 
This is not what I want. That article describes how to send to a port. What I want is to receive from a port.

I'm using that script, but my app doesn't recognise the device created by mknod.

Cheers for the quick reply.
 
Then you need a simple Perl script to listen on a port- but if you say the app can send to a port directly, why do you need anything?

Tony Lawrence
SCO Unix/Linux Resources tony@pcunix.com
 
I should probably explain that last comment better.

Since it can send to a port directly, we assume that it can print to a lpd style printer running here or elsewhere. That printer can, through various chicanery, send the output wherever you like. As any local printer can be told to accept "remote" jobs, your only problem is how to distinguish twixt what you want printed, mailed, etc- and I assume you've already figured out how that will work, probably by different printers in the app?


So- you define a regular printer, and then tell it to acept remote jobs. The jobs aren't really coming from anything remote, but that shouldn't matter..


But I've never seen an app that bothered to distinguish betwen a named pipe and a character device so I am curious to know what it is. Tony Lawrence
SCO Unix/Linux Resources tony@pcunix.com
 
The app was written about 15 years ago in Xenix and has subsequently been upgraded to Unix with features added. It's a security front end. However, it isn't very accommodating when it comes to network printing. It sends raw text directly to a port or com port direct (serial or parallel). It checks to see if it can establish control and sets it's own baud rate within the app and was designed so as not to have support agents needing to dabble into unix to set up printers.

The trouble is, even when printing to a network port, it doesn't send and end of file (EOF) or anything, so it needs to let the printer time out. That's why I use the hpnp as it provides a dummy device by way of a /dev/ttypxx that the app likes to see there all the time, and hpnp takes care of opening the printing port and closing it when activity dies down.

But...... hpnp won't print to the virtual printer that I can work out. I tried to configure the email printer as the only lpd using lpadmin. But the GUI print manager doesn't show it, even though it says it's the default, and it is there because you can't set up another printer of the same name. Even then, I tried to send a job to port 515, but nothing happened.

As a printer, I have it working quite happily sending a cat job to the virtual device or the print manager OK and it sends the mail as expected.

And now, to ask why the software manufacturer can't help - they have no Unix programmers anymore. They have chosen the windows path as the way to the next generation of it's software. It also sends the data as a raw Unix text - ie no CR with the LF which has caused me no end of grief with an old network capable laserjet IV - none of the solutions I have tried to run the file past a filter have worked, and the printer doesn't have a config to add it either.

I thought I'd have to go the perl route, but have not done anything like that before, so looks like I'm in for a crash course.

Chairs.
 
Just for anyone's info, I managed to learn PERL over the course of a weekend, 20 cups of coffee, about 20 hours at the keyboard/internet, and still make it to the family meal tables, bed time stories etc. Crawled out of my office at 5am Sunday with a working answer that works a treat for me.

I'm off to see the (hopefully) happy client tomorrow.....
 
Great.

Isn't Perl a treat? I so wish I had learned it earlier than I did.. Tony Lawrence
SCO Unix/Linux Resources tony@pcunix.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top