Summary of Findings regarding Tektronix Phaser560 and LPRng printer filters --------------------------------------------------------------------------- After using the phaser560 model of Tektronix printer our IS department determined that existing filters designed to work with LPRng do not successfully acquire a page count from the phaser560. We specifically tried the filters psfilter, and a home grown filter that we use for our phaser450 model printers (phaserif). The home grown filter is a perl script. These filters seem to go about page accounting by variations of the following method: 1. The filter checks the printers UDP port till it finds the printer at status idle. 2. The filter sends a request for the current pagecount. 3. The filter sends the job via a TCP connection. 4. The filter again checks the printers UDP port till it finds the printer at status idle. 5. The filter sends the final pagecount request to the printer. Our initial findings indicated that the filters would always fail on the second probe of the UDP port for status idle. We spent some time researching this situation with Tektronix and after phone consultations with one of their network card/Unix/IP specialists, he recommended that the above method not be used with the phaser560 printer. Based upon Tektronix's own internal findings he recommended that we scrap the use of the UDP port altogether. Instead he recommended the following steps to get proper page accounting from the phaser560: 1. The printer's AppSocket settings must have "Delayed Output Close" set to "On." This should only have to be set once from the web interface. 2. Open a TCP socket to the printer, send a pagerequest in postscript, close the TCP socket. 3. Open a second TCP socket to the printer, send the print job, close the TCP socket. 4. Open a third TCP socket to the printer, send the final pagerequest in postscript, close the TCP socket. At this point we modified our perl based phase450 filter to implement these changes. After doing so we noticed that in step 4, we consistantly received a "Connection Refused: Not Owner" error message from the connect() portion of the socket setup. We determined that since the printer still had not completed processing/printing the job, it refused all new TCP connections. At least two solutions seem to solve this problem: 1. Loop on step 4 until a connection occurs and then send the second pagerequest. One may think of this as a "brute force" solution. 2. The close() system call does not immediately close a socket. Its default action marks a socket closed and returns to the calling application. This state does not guarantee that the other end of the TCP connection has initiated a socket close also. The phaser560 seemed to demonstrate this behavior of not closing its socket immediately. In fact the printer will not close its socket in step 3 until the print job has finished. Thus, in order to guarantee a smooth transition from state 3 to state 4, we needed to know when the printer had closed its sockets. To accomplish this one must change all close(socket_descriptor) calls to shutdown(socket_descriptor) calls followed by read() until bytes read == 0. This method closes the socket on the filter end and waits until the printer finishes processing/printing the job. In addition, the filter can trap the postscript return messages sent by the printer for logging or other purposes. Once the printer finishes, then step 4 will accurately get a pagerequest from the printer. One could think of this as a more graceful, robust solution. We tried implementing a hybrid of these last two solutions in our existing perl filter, but did not succeed. Instead, we switched to a language we had greater fluency in, C. This switch also let us implement other features such as multithreaded I/O. Using the steps recommended by Tektronix, and the second solution above, we have designed and implemented a multithreaded filter that gets accurate page counts from the phaser560 printer. Currently, we are close to a solution for robust recovery from printer power-cycles. Interested parties may request copies of our filter source or more information from almar@uiuc.edu.