A local port monitor isolates the spooler from printer port characteristics by presenting idealized printer ports to the spooler. The local port monitor supplied by Microsoft is the spooler system component that monitors the flow of print job data through physical parallel or serial ports. The local print monitor presents idealized ports to the spooler by masking the difference between parallel and serial ports, serializing I/O, and providing automatic buffering services. The local port monitor can also be used to multiplex one physical port to multiple virtual ports, each having a separate name and behavior.
A Windows 95 port monitor must offer half a dozen entry points to monitor printers connected to ports and send print job data through ports. The local monitor's OpenPort function is called at spooler startup for all ports with assigned printers and, if necessary, when another printer is added to the spooler's environment. The ClosePort function is called at spooler shutdown and may be called when a printer is removed form the spooler's environment. The ReadPort function is called to read status information from connected bi-directional printers.
The StartDocPort function is called to setup the port to send print job data to the printer, a sequence of one or more WritePort function calls provide the print job data the port monitor sends to the printer, and an EndDocPort function call is called when there is no more data to send for the print job.
The local port monitor must also provide four entry points that perform port management. The AddPort function is called when the spooler wants to add a port to its environment and the DeletePort function is called when the spooler wants to remove a port from its environment. The spooler calls the ConfigurePort function to configure a port and may offer a user interface to get some of the necessary configuration information. The spooler calls the EnumPorts function to get a list of ports currently maintained by the port monitor.