You are here:Home»KB»Hardware»Printers»Why is LPR Byte Counting Enabled required?
Saturday, 04 September 2010 19:07

Why is LPR Byte Counting Enabled required?

Written by

Question: RPM does not receive print jobs from the Windows Standard TCP/IP Port unless the LPR Byte Counting Enabled option is selected. What is "LPR byte counting" and why must it be selected?

Answer: The simple answer is this: if Microsoft implemented their LPR to send zero as the number of bytes, then RPM would be able to handle that correctly. As it is Microsoft sends an impossibly huge number, instead of the actual size of the file in bytes.

The LPR/LPD protocol allows for zero as the file size though sending the actual size is typical. There are a few LPR clients in the world which handle this correctly, and RPM works as you would expect in either case.

The longer answer follows.

"LPR byte counting" forces Windows to count the number of bytes in the file and send this value in the Receive data file subcommand. To understand why this does not work, you must first understand the steps in sending a print job using the LPR/LPD protocol.

  1. The LPR client sends the Receive a printer job command.
  2. RPM replies with an acknowledgment (ACK).
  3. When the LPR client receives the ACK, it can proceed. The client then sends the Receive control file subcommand.
  4. When the LPR client receives an ACK from RPM, the control file is sent. RPM will then respond with another ACK.
  5. The LPR client now sends the Receive data file subcommand. The size must either be set to the actual size of the data file, or set to 0. This is one area where Microsoft does not follow the protocol specifications.
  6. When the client receives the ACK, it will send the data file. Once the data file has completed, the connection is closed by both parties.

When LPR byte counting enabled is turned off, Microsoft sets the <file size> to a size much larger than the actual size. It is set neither to 0 nor the actual file size. When RPM receives a file much smaller than the specified file size, RPM believes that the entire file was not sent, deletes the "incomplete" file, and waits for the file to be sent again.

RFC1179 states that you may set the size of the data file to 0, however, it does not discuss how the LPD Server should handle this "unknown length file". RPM handles the "unknown length file" situation by receiving all data from the request to send the data file until the connection is closed by the LPR client.

RPM can also handle the opposite situation, in which the file is actually 0 bytes. You tell RPM to close the connection after a specified amount of time.

To do this, follow these instructions.

  1. Choose LPD Options from the Options menu.
  2. Select Enable zero length file transfers. 600 seconds is the default amount of time to wait, however, you may raise or lower this value to meet your needs.
Read 4894 times