824-826.html

来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 139 行

HTML
139
字号
<HTML>

<HEAD>

<TITLE>Linux Unleashed, Third Edition:Setting up a Gopher Service</TITLE>

<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!--ISBN=0672313723//-->

<!--TITLE=Linux Unleashed, Third Edition//-->

<!--AUTHOR=Tim Parker//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Sams//-->

<!--CHAPTER=50//-->

<!--PAGES=824-826//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="821-824.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="826-829.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<P>The <TT>MAXLOAD</TT> variable is used if the <TT>-DLOADRESTRICT</TT> keyword was used in the <TT>SERVEROPTS</TT> variable of <TT>Makefile.config</TT>. The <TT>MAXLOAD</TT> defines the maximum load average the Gopher service will respond to requests under (this value can be overridden on the command line). The usual definition is like this:</P>

<!-- CODE SNIP //-->

<PRE>

#define MAXLOAD 10.0

</PRE>

<!-- END CODE SNIP //-->

<P>The <TT>READTIMEOUT</TT> and <TT>WRITETIMEOUT</TT> variables set the amount of time a service waits for a network read or write operation before timing out. The default settings are usually adequate. These lines look like the following:</P>

<!-- CODE SNIP //-->

<PRE>

#define READTIMEOUT (1*60)

#define WRITETIMEOUT (3*60)

</PRE>

<!-- END CODE SNIP //-->

<P>The Gopher client&#146;s configuration is straightforward. Begin by defining the Gopher servers the local machine connects to with the <TT>CLIENT1_HOST</TT> and <TT>CLIENT2_HOST</TT> entries. The Gopher client chooses one of the two (if both are defined) when it is started. The entries look like this:</P>

<!-- CODE SNIP //-->

<PRE>

#define CLIENT1_HOST &#147;gopher_serv.tpci.com&#148;

#define CLIENT2_HOST &#147;other_gopher_serv.tpci.com&#148;

</PRE>

<!-- END CODE SNIP //-->

<P>The ports to be used to connect to the hosts are defined with these options:

</P>

<!-- CODE SNIP //-->

<PRE>

#define CLIENT1_PORT 70

#define CLIENT2_PORT 70

</PRE>

<!-- END CODE SNIP //-->

<P>If you have a local service and don&#146;t want to use port 70 (to prevent access from the Internet, for example), set the proper port values. If only one Gopher server is used, set the second value to <TT>0</TT>.</P>

<P>Define the language the Gopher client will use by choosing one value out of a number of options. The default is American English, set by this command:</P>

<!-- CODE SNIP //-->

<PRE>

#define DEFAULT_LANG &#147;En_US&#148;

</PRE>

<!-- END CODE SNIP //-->

<P>Other language defines are commented out below this one. If you want to change the default language, comment the American English setting and uncomment the one you want.

</P>

<P>When all the configuration changes are made, you can invoke the compilation process for the client and server with these commands:</P>

<!-- CODE SNIP //-->

<PRE>

make client

make server

</PRE>

<!-- END CODE SNIP //-->

<P>Or you can do both client and server systems at once by using the <TT>make</TT> command with no argument. The programs and data files must be installed, too, using the command:</P>

<!-- CODE SNIP //-->

<PRE>

make install

</PRE>

<!-- END CODE SNIP //-->

<H4 ALIGN="LEFT"><A NAME="Heading7"></A><FONT COLOR="#000077">WAIS and Gopher</FONT></H4>

<P>Gopher clients have the ability to use WAIS indexes to search for documents, but the system must be configured to allow this. We looked at WAIS in Chapter 49, &#147;Configuring a WAIS Site,&#148; so for the sake of providing WAIS index access to Gopher, we&#146;ll assume you have installed WAIS properly and have WAIS indexes ready for Gopher.

</P>

<P>To provide WAIS services through Gopher, you may have to make a change in the WAIS source code. Examine the WAIS source code for a line that looks like this:</P>

<!-- CODE SNIP //-->

<PRE>

if (gLastAnd) printf(&#147;search_word: boolean &#146;and&#146; scored/n:);

</PRE>

<!-- END CODE SNIP //-->

<P>This line should be commented out to provide Gopher services, so if it is not, add C comment symbols before and after the line, like this:

</P>

<!-- CODE SNIP //-->

<PRE>

/* if (gLastAnd) printf(&#147;search_word: boolean &#146;and&#146; scored/n:); */

</PRE>

<!-- END CODE SNIP //-->

<P>If the line is already commented out (or didn&#146;t exist), then you don&#146;t need to make any changes. If you change the line, though, you have to recompile WAIS by changing into the WAIS top directory and running the <TT>makefile</TT> (enter the command <TT>make</TT>).</P>

<P>Next, examine the Gopher <TT>Makefile.config</TT> file and look for the <TT>WAISTYPE</TT> variable. It should be defined on a line like this:</P>

<!-- CODE SNIP //-->

<PRE>

WAISTYPE = #-DFREEWAIS_0_4

</PRE>

<!-- END CODE SNIP //-->

<P>Then, you have to link the Gopher and WAIS services. Suppose your Gopher source directory is <TT>/usr/gopher/source</TT> and the WAIS source directory is <TT>/usr/wais/source</TT>. You can link these services by entering the following commands:</P>

<!-- CODE SNIP //-->

<PRE>

cd /usr/gopher/source

ln -s /usr/wais/source/include ./ir

ln -s /usr/wais/source/client/ui .

ln -s /usr/wais/source/bin .

</PRE>

<!-- END CODE SNIP //-->

<P>When Gopher is recompiled, it connects the links between Gopher and freeWAIS and allows the two services to interwork.

</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="821-824.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="826-829.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?