p910nd is a small printer daemon intended for diskless workstations that does not spool to disk but passes the job directly to the printer. Normally a lpr daemon on a spooling host connects to it with a TCP connection on port 910n (where n=0, 1, or 2 for lp0, 1 and 2 respectively). p910nd is particularly useful for diskless Linux workstations such as those set up with LTSP and embedded devices that have a printer hanging off them. Common Unix Printing System (CUPS) supports this protocol, it's called the AppSocket protocol and has the scheme socket://. LPRng also supports this protocol and the syntax is lp=remotehost%9100 in /etc/printcap.
Here is the man page.
Mustafa Karaca (mustafakaraca/airties/com) sent me an email saying:
It appears that select() is called with invalid timeout value. You can find the .diff filed as attached.
Also daemon blocks on select() for a long time if the network connection is dropped (for example, if we unplug the network cable when a data transfer is happening from a windows xp box). So, specifying a timeout value for the network connection could be a solution (see p910d_timeout.diff). If the connection is dropped because of some unknown problem, daemon will close the current stream after specified amount of time has passed without a network activity and will start listening for new connections to arrive.
It does seem that the variable "then" could be used before setting. I have tried contacting Dave Brown, the original author of the reverse channel patches for comment, but have had not heard back. Since at the moment I don't have the time to review the patch, I would be grateful for feedback on it. Please also CC Mustafa, whose anti-spammed address is above.
Here are: the proposed fix and the proposed enhancement to the command line options.
Version 0.93 fixes the call to open with O_CREAT to include the mode.
Version 0.92 adds a patch by Dave Brown to reduce CPU usage for printers that are chatty on the reverse channel. This patch is most useful for low-powered platforms such as embedded routers.
Version 0.91 adds a patch by Hans Harder that closes the device after each job so that it doesn't crash with hotpluggable devices which may go away between jobs. I've tested it with a USB printer that is sometimes switched off and it seems to work well.
Version 0.9 adds patches by Kostas Liakakis to improve behaviour when the printer device can't be opened under NetBSD, and patches by Albert Bartoszko to the Makefile.
Version 0.8 allows binding to a specified IP address.
Version 0.7 supports bidirectional copying, activated with the -b option, useful for getting status from printers.
Version 0.6 has minor cleanups by Arne Bernin.
Version 0.5 adds support for libwrap (tcpwrappers) so that the server can be more selective about who can connect to it.
p910nd is released under the GPLv2.
I haven't really been keeping track but projects that have adopted it include the 3.x versions of LTSP, although for unexplained reasons they renamed the software, and many embedded router projects such as OpenWRT. Here's a LRP based print server use.
p910nd at SourceforgeLast updated 2009-09-01 by Ken Yap