|LPRng Reference Manual: 26 Nov 2010 (For LPRng-3.8.35)|
|Prev||Chapter 11. Printer Communication and Protocols||Next|
The Socket API is a very flexible job transfer protocol. It is widely support by most Print Server manufacturers, with the Hewlett Packard JetDirect setting the de facto standard. The Socket API is extremely simple.
The user establishes a connection to TCP/IP port on the Printer or Network Print spooler. The HP JetDirect uses port 9100 by default, but other ports are used as well. This connection may be refused if the printer is busy printing a job.
When the network connection is established to a system which has an internal printer or for which the Network Print Spooler is an integral part of the system, the printer usually flushes all internal buffers and readies itself to receive a new job. However, when you are using an external Print Server box, you may need to send specific initialization sequences to the printer to ensure that it is reset correctly and is ready to receive new jobs.
When the connection is made, all bytes sent to the connection are either transferred to and external interface to directly to a print buffer used by the printer's Print Engine.
The connection is bidirectional, and information sent to the external port by an external printer or error messages and status generated by the printer's Print Engine will be transferred over the data link to the user.
The Network Print spooler will keep the connection open until it is closed by the user. During this period it may continue to report status or other information such as printer On Line, paper outages, and so forth.
If the connection to the printer is half-closed,
that is, the
network system call is used to indicate to the remote
printer that no further data will be sent, then the
printer may immediately terminate the network connection.
This means that no further network or status messages
will be sent to the user.
If the connection is to a External Print Server, then usually the connection can be immediately re-established. It is the responsibility of the user to ensure that a the printer has finished its work before sending a new job.
If the connection is to an internal Print Server, then usually the printer will not allow the connection to be made, or will refuse all data transfers on the connection until the printer finishes with the previous job and all internal buffers have been cleared.
The following is a sample printcap showing how to use the Socket API:
You can use the netcat
utility by Hobbit
test that the Socket interface is available and working. If
ellipse.ps is a test file, then:
The simplest and easiest way to print a file to a network