libsocket 0.7.2 Installation
============================

libsocket Copyright 1997, 1998 by Indrek Mandre
libsocket Copyright 1997, 1998 by Richard Dawe
Portions of libsocket Copyright 1997, 1998 by the Regdos Group

Decompression
-------------

As of version 0.7.1, libsocket uses the contrib/ directory layout, and should
be unzipped into the DJGPP directory. As of version 0.7.2, libsocket can be
unpacked using any unZIPper and you will still be able to use the library and
the HTML documentation. Previous versions required unpacking with programs
like InfoZip or WinZip, which can cope with long filenames. You need a long
filename unpacker to use the man pages, however. If you use PKZip, don't forget
to use the '-d' option! All the filenames in the archive will be prefixed with
contrib/lsck<version>/, e.g. contrib/lsck072/, or manifest/, so it is safe to
decompress into the DJGPP directory, as all the files will go into a
sub-directory.

Once the library has been decompressed, changed into its directory and
type "make" for a list of targets. The source distribution will
have more targets than the binary distribution. To compile everything that
comes with the distribution, type the following:

    make distclean
    make dep
    make all

If you are using the binary distribution, then there is one more step
before the code can be used. If you are using long filenames, then the
library from the archive must be given a long filename - use "make
lfn" to do this. This problem does not occur with the source distribution.
"make lfn" can be undone by using "make sfn".

Configuration
-------------

Please read this section carefully. It may be the case that no configuration
is necessary. I realise that this is probably the least clear part of using
libsocket, so if this section does not make sense or answer any of your
questions, please ask me about
it.

libsocket comes with a configuration program, Netsetup,
that creates the configuration files. libsocket uses the same set of configuration
files as Linux: hosts, host.conf and resolv.conf. These are described below,
and have links to the appropriate man pages. Note that they are usually
stored in c:\windows under Windows rather than /etc under Linux.


File        Function
----        --------

hosts       "Resolving": Name to IP address translation, e.g.
            fred.acme.com => 192.168.0.123

host.conf   Tells the name resolver whether to look at hosts or use the
            DNS server first

resolv.conf Tells the name resolver the domain name and the DNS server's
            IP address


Netsetup can be compiled and run by typing "make netsetup". It will need to
know the following information:

- Your computer's name - This will be placed in the hosts file.

- Your computer's IP address - This will be placed in the hosts file.

- Your domain name - This will be placed in the resolv.conf file.

- Whether you have a DNS server or not, and what its IP address is - This
  is used to construct host.conf and resolv.conf.

The files created are hosts.eg, host.conf and resolv.conf, all in the setup/
directory. They need copying to a directory where libsocket will find them
on start-up. You can specify this directory using the LIBSOCKET environment
variable, e.g.

    SET LIBSOCKET=C:\NETCONFIG

at the DOS prompt, or in autoexec.bat, or a line in djgpp.env in your
DJGPP directory (see the DJGPP FAQ for more details). If you do not specify
it, the Windows directory is searched. When copying these files, don't
forget to back-up the old hosts file, and don't forget to rename hosts.eg
to hosts.

Note 1: If you configured libsocket using an earlier version
of libsocket, then please reconfigure it with the latest version of Netsetup
- there may have been bugs in the older version.

Note 2: If you run netsetup while using short filenames, then
the filenames will not be as above. resolv.conf will be called resolv.con
and host.conf will be called host.con. Don't worry about this - libsocket
will find these files. If you configure libsocket with short filenames
and then use programs with long filenames and vice-versa, then libsocket
will still find the configuration files (as of version 0.7.2).

Testing
-------

To test the configuration of the library, try running one of the demos,
e.g. the name resolving program resit. Try:

    demo\resit <your computer name>

This should display the IP address you gave Netsetup.

Auto-configuration
------------------

libsocket can also determine some settings from the Registry. It can
determine the DNS server's IP addresses from the registry in the following
circumstances:

1. the DNS server(s) IP addresses have been set in the networking control
   panel for a permanent network connection;

2. the computer is using dial-up TCP/IP access with static (fixed) DNS
   server IP addresses.

In these cases, Netsetup does not need to be run. Netsetup requires the
computer's name only to set-up the hosts file - libsocket can determine
the host-name automatically.

Netsetup is probably most useful on private networks where there is
unlikely to be a DNS server.

Using the Library in Other Programs
-----------------------------------

Before the library can be used in other programs, the header files (include
files) and library must be copied to the DJGPP directories. This can be
done by typing "make install". Then, using the library in a program
is simply a matter of including the correct files (e.g. "#include <socket.h>")
and linking in the library with the "-lsocket" option on the linker
line.

As noted earlier, if one wishes to use libsocket with long filenames,
one should type:

    make lfn
    make install

One should use this when compiling under Windows '95 command prompt.

Using the man Pages
-------------------

To install the man pages, type "make installman". To view the
main libsocket man page, type "man libsocket".
