[Download]
     
Library Reference (~330K HTML!)

Jump to: [Availability] [Installation]


Availability

Where to Download libsocket

http://libsocket.home.ml.org/

The above URL is a forwarding link. This will always point to the libsocket home pages. Please use this link, as it will allow me to move the home pages, when I need to.

libsocket can be downloaded from the DJGPP archive, although the version on the archive may be older than is available from this page. A mirror of the DJGPP archive can be found in the UK at Sunsite in its Simtelnet mirror ftp://sunsite.doc.ic.ac.uk/packages/simtelnet/gnu/djgpp/ in the v2tk/ directory. If you do not know of a local mirror site, click below to download from the main distribution site:

Version 0.7.3 distributions - Release 1, 18th August 1998
Binary distribution (470K) http://www.geocities.com/SiliconValley/Lab/3216/lsck073b.zip
Source distribution (600K) http://www.geocities.com/SiliconValley/Lab/3216/lsck073s.zip
Version 0.7.2 distributions - Release 4, last updated on 15th July 1998 - please see the news item.
Binary distribution (394K) http://www.geocities.com/SiliconValley/Lab/3216/lsck072b.zip
Source distribution (527K) http://www.geocities.com/SiliconValley/Lab/3216/lsck072s.zip

I know the links in this document are UK-centric. I'd be happy to make up for this, if you mail me international links.

Which Distribution to Download

If you simply wish to use libsocket in programs, download the binary version. If you're interested in how libsocket works, or you wish to modify the library, download the source distribution. If you download the source distribution, you will be able to compile a debugging version of the library. The documentation is included in both distributions.

What libsocket requires

The following DJGPP packages are required to compile libsocket's demo programs and the library:

The following DJGPP packages are required to view the man page documentation:

The following DJGPP packages are required to rebuild the HTML versions of the man page documentation:

libsocket requires TCP/IP networking to have been installed. This can be done from the Windows '95 networking control panel.

[Top]


Installation

Please read this section carefully, as installation is quite complicated. Also, the FAQ may be able to answer some of your questions. If not, please ask me, and I'll try to help.

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>/, i.e. 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.

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

networks "Resolving": Network name to network IP address translation, e.g. my.net -> 192.168.0

host.conf Tells the name resolver whether to look at the hosts file 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.

  • Your network mask or network IP address - This will be placed in the networks 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.

Note: Much of this information can be obtained under Windows '95 by running the program 'winipcfg'. Also, there is a configuration section in the FAQ, which deals with specific questions.

The files created are hosts.eg, networks.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 (see Netsetup bugfix 1, 2).

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 Network Control Panel for a permanent network connection;

  2. the computer is using dial-up TCP/IP access with static (fixed) DNS server and computer 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.

Note: Auto-configuration probably didn't work until version 0.7.3. It would be useful to know if libsocket *does* actually work using either of the above set-ups.

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".

[Top]


The layout of this page is by Indrek Mandre, and the content is by Richard Dawe.


[Left] [Top] [Right]