Products   Support   Download   Contact

DISCOVERING PRINTER'S TCP PORTS

Contents | Index | About the Icons

Abstract

The ScriptServer® For OpenVMS product has an optional autoconfigure mode which attempts to dynamically discover these ports; this is not implemented in the ScriptServer PAN Printing System product. Instead, GrayMatter Software provides a perl script which will attempt to discover these ports, in addition to testing whether or not the printer answers up on the traditional LPD port.

The perl script is available via

FTP: ftp://ftp.graysoft.com/pan/misc/port-test.plx
HTTP:

http://www.graysoft.com/download/pan/misc/port-test.txt

NOTE: the file extension .txt is used for compatibility with the web server and your browser (the .plx version exists as well); you should rename the file to have no extension, or an extension of .pl or .plx when you save your downloaded copy.

and contains embedded POD documentation, as well as a GrayMatter Software copyright statement.

Many networked printers support a direct TCP connection to the RIP (Raster Image Processor: the program which renders the data stream into a format which can be imaged by the mechanical print engine) in addition to LPD; this is in addition to telnet or web administration (or job submission) services. These ports may or may not be documented by the vendor, but often can provide the most functional interface to the printer's capabilities, as well as being the most trouble-free when properly configured.

Among the manufacturers whose printers support direct TCP connections with the RIP are:

Background Concerning TCP Connections Supported By Printers

As network devices, printers may support TCP connections on a variety of ports for a variety of purposes. (This pertains to printers which support IP; printers may also support AppleTalk, DECNet or Novell among others.)

Administrative

Many printers support administrative access via either traditional telnet (port 23) or a web interface (port 80).

LPD

LPR/LPD is the "traditional", non-standard standard way of sending print jobs on Unix-like operating systems. When there is no RIP connection (or no support by the printer driver or print server for a RIP connection), LPD is the typical generic mechanism for sending a job to a printer.

LPD works, but we encourage you to try to find a better way. Our experiences with LPD and ScriptServer For OpenVMS are documented in a prior Technical Memo.

RIP

In the logical sense of what being "connected" means, talking directly to the program in the printer which accepts a print job and renders it for imaging by the physical print engine is about as connected as you can get. This sort of connection is supported by many printers (especially departmental and workgroup printers), although it may not be documented by the manufacturer.

This sort of connection has been around for many years, and has its roots as far back as printers connected to hosts with serial cables (in a sense, a TCP connection is like a serial cable... except a lot faster and a lot less trouble to hook up). GrayMatter Software has extensive experience communicating with RIPs in this manner, and our software products make use of the bidirectional nature of these connections to obtain feedback from the printer as it processes the job.

This is the sort of connection which the perl script is intended to discover, as the particular port utilized varies between RIP implementations and manufacturers.

IPP

The Internet Printing Protocol is fairly new, and may be supported on newer printers. As it becomes more common, and based on customer interest, it is likely that the ScriptServer PAN Printing System will support IPP. If you're a paying customer and you want IPP support for a particular make/model of printer, tell us about it!

Using the perl Script

The perl script was written and tested using perl v 5.5.3 and should also work with perl v5.6. It uses the Getopt::Std and IO::Socket modules.

The script first attempts to ping the printer, and then it attempts to establish TCP connections on various ports where printers typically answer up, including:

The command syntax is:

port-test.plx -Hprinter-address [-v] [-dseconds] [-p]

The command line switches/parameters are:

-Hprinter address (required)

The IP address or domain name assigned to the printer.

-v(erbose) (optional)

Turns on verbose mode, where additional information is printed about the operation of the script. Can be particularly useful in combination with -p

-d(elay)seconds (optional)

The number of seconds to delay before trying to connect to the next port. Defaults to 1.

-p(ingable) (optional)

Causes the script not to treat a ping failure as fatal. Can be particularly useful in combination with -v.

Using the Information Returned By The perl Script

If the printer doesn't answer ping, see the notes below and make sure your printer is truly powered up, connected to your network, and configured with an IP address. Once in a while a printer simply won't answer ping.

Provided that the script indicates a successful attempt to connect on some port other than LPD configure it that way, using the information returned by the script to select a Communications style and IP port.

If the only thing the printer answers up on is the LPD port, then set it up with LPD as the Communications style.

If you have problems or wish additional assistance, contact us.

Issues In The Field

Several issues arise in practice when scanning a printer for ports and need to be considered when scanning a printer with the perl script. In general it is best to have the printer on the same network segment as the node on which the perl script is running, and to ensure that no jobs are being printed while attempting to discover ports:

ping

ping is both a diagnostic command and a protocol; its purpose is to determine whether or not a node is "connected". In order to do this, a special IP packet is sent to the node being tested and if the node is there and supports ping it "echoes" the packet. While virtually all popular printers support ping, it is not universal. Firewalls and NAT (Network Address Translation) may also prevent ping from working, and busy networks may simply drop ping packets (this is by design).

Hence, the success or failure of ping is strong but not conclusive evidence of connectivity.

ping is available on almost all Unix and Unix-like hosts, although it may be restricted to use by privileged accounts. ping is also available from the DOS Shell on most Windows machines, and is also supported by various network diagnostic utilities (some which are freeware) such as MacTCPWatcher under MacOS. (A number of router/firewalls also support it via their internal command line interfaces, including the Cisco 675 small/home office DSL modem/router.)

The general format for the ping command is

ping hostname or address

Read the documentation for the ping command on your particular server/host before attempting to use it; by default some implementations may send one or several packets and then stop and report results, while others will run forever (!) until the operator intervenes with an appropriate interrupt action (often Control-C entered from the keyboard). Your network administrators may get irritated if you leave ping running forever.

The perl script sends a single ping packet. By default it will abort if a response is not received, although this behavior can be overridden with the -p switch.

Availability of Ports While Printing Jobs

RIP ports may not answer up when jobs are actively being printed, especially with older printers. Hence it is advisable to ensure that the printer is idle when testing with the perl script. Two possible situations may be encountered.

© 2020 GrayMatter Software Corporation