1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
3<html>
4  <head>
5    <meta name="generator" content="HTML Tidy, see www.w3.org">
6    <title>It was working normally, then I get connection refused
7    errors</title>
8    <meta name="GENERATOR" content=
9    "Modular DocBook HTML Stylesheet Version 1.7">
10    <link rel="HOME" title=" LPRng Reference Manual" href=
11    "index.htm">
12    <link rel="UP" title="The Most Frequently Asked Questions "
13    href="faq.htm">
14    <link rel="PREVIOUS" title=
15    "The Most Frequently Asked Questions " href="faq.htm">
16    <link rel="NEXT" title=
17    "Job is not in print queue, but it gets printed!" href=
18    "x10735.htm">
19  </head>
20
21  <body class="SECT1" bgcolor="#FFFFFF" text="#000000" link=
22  "#0000FF" vlink="#840084" alink="#0000FF">
23    <div class="NAVHEADER">
24      <table summary="Header navigation table" width="100%" border=
25      "0" cellpadding="0" cellspacing="0">
26        <tr>
27          <th colspan="3" align="center">LPRng Reference Manual: 5
28          Sep 2003 (For LPRng-3.8.22)</th>
29        </tr>
30
31        <tr>
32          <td width="10%" align="left" valign="bottom"><a href=
33          "faq.htm" accesskey="P">Prev</a></td>
34
35          <td width="80%" align="center" valign="bottom">Chapter
36          20. The Most Frequently Asked Questions</td>
37
38          <td width="10%" align="right" valign="bottom"><a href=
39          "x10735.htm" accesskey="N">Next</a></td>
40        </tr>
41      </table>
42      <hr align="LEFT" width="100%">
43    </div>
44
45    <div class="SECT1">
46      <h1 class="SECT1"><a name="AEN10703">20.2. It was working
47      normally, then I get connection refused errors</a></h1>
48
49      <p>This message usually appears when you have been sending a
50      large number of jobs to a network printer or a remote system.
51      The reason for this is a combination the above port 721-731
52      restriction and the TCP/IP timeouts. For details, see <a
53      href="rfc1179ref.htm">RFC1179 and <b class=
54      "APPLICATION">LPRng</b></a>, but here is a quick
55      explanation.</p>
56
57      <p>A TCP/IP connection is usually specified as between <var
58      class="LITERAL">srchost:srcport, desthost:destport</var>,
59      although in practice the order of source (src) and
60      destination (dest) is not important.</p>
61
62      <p>When a connection is established, each end of the
63      connection exchanges the necessary flow control and error
64      control information. When a connection is terminated, each
65      end of the connection will not accept another connection from
66      the same <var class="LITERAL">host:port</var> that was
67      previously active for a specified timeout period, usually 10
68      minutes.</p>
69
70      <p>Some TCP/IP implementations go further: they will not
71      allow <acronym class="ACRONYM">ANY</acronym> connection to be
72      <span class="emphasis"><i class=
73      "EMPHASIS">originated</i></span> (via the <code class=
74      "FUNCTION">bind()</code> system call or API) from a port that
75      was active, or accepted on a port that was active for this
76      timeout period.</p>
77
78      <p>Now let us see what happens when we have a client program,
79      which must originate a connection on port 721-731, connect to
80      the server, which waits for a connection on port 515. We
81      first try to make a connection from host:port <var class=
82      "LITERAL">1.1.1.1:721</var> to <var class=
83      "LITERAL">1.1.1.2:515</var>. The first time that we make the
84      connection (or the first connection) we succeed. We can
85      transfer a file, etc., and then close the connection. When we
86      try to reconnect from <var class="LITERAL">1.1.1.1:721</var>
87      to <var class="LITERAL">1.1.1.2:515</var> we get an error
88      such as "address already in use" or "connection refused".</p>
89
90      <p>Luckily, we can use port 722 to originate a connection,
91      and we can connect from <var class=
92      "LITERAL">1.1.1.1:722</var> to <var class=
93      "LITERAL">1.1.1.2:515</var>. We continue on, until we come to
94      port 731, and then we need to wait for our timeouts.</p>
95
96      <p>SOLUTION:</p>
97
98      <p>It appears that most RFC1179 implementations do not check
99      for the exact port range 721-731, but only that the
100      connection originates from a reserved port, i.e. - in the
101      range 1-1023. You can extend the range of ports used by <b
102      class="APPLICATION">LPRng</b> by changing the</p>
103
104      <div class="INFORMALEXAMPLE">
105        <a name="AEN10727"></a>
106<pre class="SCREEN">
107    originate_port=721 731
108</pre>
109      </div>
110      value in the defaults (<tt class=
111      "FILENAME">LPRng/src/common/defaults.c</tt>) file or in the
112      <tt class="FILENAME">lpd.conf</tt> file. I recommend the
113      following: 
114
115      <div class="INFORMALEXAMPLE">
116        <a name="AEN10731"></a>
117<pre class="SCREEN">
118    originate_port=512 1022
119</pre>
120      </div>
121      This is, in fact, now the default in <b class=
122      "APPLICATION">LPRng</b> software. If you get the infamous
123      <var class="LITERAL">malformed from address</var> error
124      message from your spooler, then you will have to set
125      originate_port=721 731, and live with a delayed
126      throughput.<br>
127      <br>
128    </div>
129
130    <div class="NAVFOOTER">
131      <hr align="LEFT" width="100%">
132
133      <table summary="Footer navigation table" width="100%" border=
134      "0" cellpadding="0" cellspacing="0">
135        <tr>
136          <td width="33%" align="left" valign="top"><a href=
137          "faq.htm" accesskey="P">Prev</a></td>
138
139          <td width="34%" align="center" valign="top"><a href=
140          "index.htm" accesskey="H">Home</a></td>
141
142          <td width="33%" align="right" valign="top"><a href=
143          "x10735.htm" accesskey="N">Next</a></td>
144        </tr>
145
146        <tr>
147          <td width="33%" align="left" valign="top">The Most
148          Frequently Asked Questions</td>
149
150          <td width="34%" align="center" valign="top"><a href=
151          "faq.htm" accesskey="U">Up</a></td>
152
153          <td width="33%" align="right" valign="top">Job is not in
154          print queue, but it gets printed!</td>
155        </tr>
156      </table>
157    </div>
158  </body>
159</html>
160
161