ptg10805159
21
Communica ting with a
Networ k Pr inter
21.1 Introduction
We now develop a program that can communicate with a network printer.These
printers areconnected to multiple computers via Ethernet and often support PostScript
files as well as plain text files. Applications generally use the Internet Printing Protocol
(IPP) to communicate with these printers, although some support alternative
communication protocols.
We are about to describe two programs: a print spooler daemon that sends jobs to a
printer and a command to submit print jobs to the spooler daemon. Since the print
spooler has to do multiple things (e.g., communicate with clients submitting jobs,
communicate with the printer,read files, scan directories), this gives us a chance to use
many of the functions from earlier chapters. For example, we use threads (Chapters 11
and 12) to simplify the design of the print spooler and sockets (Chapter 16) to
communicate between the program used to schedule a file to be printed and the print
spooler,and also between the print spooler and the network printer.
21.2 The Inter net Pr inting Protocol
IPP specifies the communication rules for building network-based printing systems. By
embedding an IPP server inside a printer with an Ethernet card, the printer can service
requests from many computer systems. These computer systems need not be located on
the same physical network, however.IPP is built on top of standardInternet protocols,
so any computer that can create a TCP/IP connection to the printer can submit a print
job.
789