1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<title>Socket API</title>
<meta name="GENERATOR" content=
"Modular DocBook HTML Stylesheet Version 1.71 ">
<link rel="HOME" title=" LPRng-HOWTO" href="index.htm">
<link rel="UP" title="Printer Communication and Protocols "
href="printercomm.htm">
<link rel="PREVIOUS" title="RFC1179 (LPD) Connection" href=
"x4814.htm">
<link rel="NEXT" title="AppSocket TCP/IP Protocol " href=
"appsocket.htm">
</head>
<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link=
"#0000FF" vlink="#840084" alink="#0000FF">
<div class="NAVHEADER">
<table summary="Header navigation table" width="100%" border=
"0" cellpadding="0" cellspacing="0">
<tr>
<th colspan="3" align="center">LPRng-HOWTO: 1 Apr 2002
(For LPRng-3.8.10)</th>
</tr>
<tr>
<td width="10%" align="left" valign="bottom"><a href=
"x4814.htm" accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom">Chapter
11. Printer Communication and Protocols</td>
<td width="10%" align="right" valign="bottom"><a href=
"appsocket.htm" accesskey="N">Next</a></td>
</tr>
</table>
<hr align="LEFT" width="100%">
</div>
<div class="SECT1">
<h1 class="SECT1"><a name="SOCKETAPI">11.3. Socket
API</a></h1>
<p>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 <i class=
"EMPHASIS">de facto</i> standard. The Socket API is extremely
simple.</p>
<ol type="1">
<li>
<p>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.</p>
</li>
<li>
<p>When the network connection is established to a system
which has an <i class="EMPHASIS">internal printer</i> 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.</p>
</li>
<li>
<p>When the connection is made, all bytes sent to the
connection are either transferred to and external
interface to directly to a <i class="EMPHASIS">print
buffer</i> used by the printer's Print Engine.</p>
</li>
<li>
<p>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.</p>
</li>
<li>
<p>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.</p>
</li>
<li>
<p>If the connection to the printer is <i class=
"EMPHASIS">half-closed</i>, that is, the <tt class=
"FUNCTION">shutdown()</tt> 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.</p>
</li>
<li>
<p>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.</p>
</li>
<li>
<p>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.</p>
</li>
</ol>
<br>
<br>
<p>The following is a sample printcap showing how to use the
Socket API:</p>
<div class="INFORMALEXAMPLE">
<a name="AEN4870"></a>
<pre class="SCREEN">
lp:
# make a socket connection to port 9100
:lp=10.0.0.2%9100
</pre>
</div>
<br>
<br>
<p>You can use the <a href=
"http://www.l0pht.com/~weld/netcat/" target="_top">netcat</a>
utility by Hobbit <tt class="EMAIL"><<a href=
"mailto:Hobbit@avian.org">Hobbit@avian.org</a>></tt> to
test that the Socket interface is available and working. If
<tt class="FILENAME">ellipse.ps</tt> is a test file, then:
The simplest and easiest way to print a file to a network
printer appears</p>
<div class="INFORMALEXAMPLE">
<a name="AEN4876"></a>
<pre class="SCREEN">
nc printer.ip.addr 9100 < file
Example:
nc 10.0.0.25 9100 < ellipse.ps
</pre>
</div>
<br>
<br>
</div>
<div class="NAVFOOTER">
<hr align="LEFT" width="100%">
<table summary="Footer navigation table" width="100%" border=
"0" cellpadding="0" cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href=
"x4814.htm" accesskey="P">Prev</a></td>
<td width="34%" align="center" valign="top"><a href=
"index.htm" accesskey="H">Home</a></td>
<td width="33%" align="right" valign="top"><a href=
"appsocket.htm" accesskey="N">Next</a></td>
</tr>
<tr>
<td width="33%" align="left" valign="top">RFC1179 (LPD)
Connection</td>
<td width="34%" align="center" valign="top"><a href=
"printercomm.htm" accesskey="U">Up</a></td>
<td width="33%" align="right" valign="top">AppSocket
TCP/IP Protocol</td>
</tr>
</table>
</div>
</body>
</html>
|