Knowledge for our questions, fun for everyone!
Knowledge for our questions, fun for everyone!
Table of contents
Introduction
Setup
Contents
::server
::net
::generic
Download
Top Sections
Libros (160)
Escalada (68)
Outdoor sports (62)
Mountain Bike (58)
Load Balancer (18)
Top project downloads
Jail (20592)
Load Balancer (4084)
eventmonitor (2997)
phptemplater (2478)
Libxml (1447)
Top active projects
Jail (10776)
libnetcomm (10319)
Libxml (9030)
phptemplater (8470)
eventmonitor (7432)
Exits
LibThreaded at Freshmeat
LibThreaded in the WWW
Go back to projects
Poll (101 votes)
What kind of templates you use?
None
String replacements
Smarty
PHPTemplater

Setting up libthreadedserver

Introduction
Setting up libthreadedserver
Introduction

Index

  1. Introduction
  2. Arch & compiler overview
  3. Requirements
  4. Uncompress distro
  5. Choose install directory
  6. Configuring Makefile
  7. Compiling and installing
  8. Using the library
  9. Bugs & support

Introduction

This library provides the required class and framework to create threaded servers in C++. This library is part of a bigger project IT/m, but you can use it as a framework for new developements. This library is release under the GNU Library license, and it is an intellectual property of me, Juan M. Casillas.

Arch & compiler overview

This library has been developed using a g++ 2.95.2 version. Also, It has been tested in a 2.95.3 version, and it works. My libc library version is 2.1.3. The distribution is a Debian potato 2.2. Finally, my arch is a intel 686 processor, with a 2.2.17 kernel.

Requirements

You need at least the 2.95.2 g++ compiler, a gnu makefile and the linux threads installed. If you plan to mess up with the tcpssl class, you need also a working openssl environment, with all the include and library files propertly installed. For install and setup openssl, see the openssl web site. The version of openssl used for test and developement is 0.9.5a.

The developement platform is a linux (intel) box, so if you plan to migrate this library to other platform, please send me the patches to include them in the main developement tree.

This library depends on libtool (at least version 0.85) so you need to have it installed in your system. You can download it from the web site Also, you can find the setup and installation instructions there.

This library also depends on libnetcomm (at least version 0.94) so you need to have it installed in your system. You can download it from the web site. Also, you can find the setup and installation instructions there.

Uncompress distro

The first thing is uncompress the distribution in a directory. For example, I will use the /tmp directory:

        halt% tar xfz libthreadedserver-0_45.tar.gz
        halt% cd libthreadedserver-0_45
        halt% pwd
        /tmp/libthreadedserver-0_45
        halt%

Ok, remember this directory, because we need it in the following step.

Choose install directory

We have to plan where to install the library. For developement pourpouses, is better having this libraries separated from the 'production' ones, so I usually create a directory in my home, called 'devel'. The only drawback of this configuration, is that you need to setup the LD_LIBRARY_PATH environment variable propertly to handle this directory. If you don't want to set this variable, you can insert the directory in the /etc/ld.so.conf file and issue a 'ldconfig' command.

In this example, I choose as install directory /home/assman/devel. So I create it first:

        halt% mkdir -p /home/assman/devel/{include,lib}

Configuring Makefile

Now we go to the libthreadedserver directory and edit the Makefile file. In the example, the libthreadedserver directory is /tmp/libthreadedserver_0_45 so:

        halt% cd /tmp/libthreadedserver_0_45
        halt% vi Makefile

First, we find the first variable in the file, BASEDIR and set up to the libthreadedserver directory:

        export BASEDIR=/tmp/libthreadedserver_0_45

Second, we find the second variable, INSTALLDIR, and set up to the installation directory:

        INSTALLDIR=/home/assman/devel

Third, we need to point to the libtool & libnetcomm header files, so find the variable LIBTOOL_INCLUDE and point it to this place. In this example, I assume that libtool is installed under /home/assman/devel/include, so I setup this variable in the Makefile:

        export LIBTOOL_INCLUDE = /home/assman/devel/include

Four, if we have installed the TCPSSL support in libnetcomm (see library's documentation files to see how to do that) we can choose if we want to compile into the library elements the support for TCPSSL code. By default, this feature is disable, but if you want it, you only have to uncomment the following line:

        export LIBNETCOMM_DEFINE= -D__LIBNETCOMM_USE_SSL__

Compiling and installing

Now issue a 'make' command to compile all the elements of the library, and to build it. If no problem is found, you can install the library in the choosed directory. Note that you need to have write permissions in this directory, so you should become root if you want to install it in a system directory (e.g. /usr/local). Now, issue a 'make install'. This will copy and create all the links and required files.

Using the library

If you plan to use the library for developement, you need to include the header files in your programs, and link with the library to proper work Also, you need to setup the LD_LIBRARY_PATH if you want to run the programs you compile. In our example, a setup for the LD_LIBRARY_PATH can be:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/assman/devel

Bugs & support

This library has been in-deep tested, but some bugs can arised. Also, you can have some ideas, or improvements for this library. Please send me an email if you found some bug, if you need support installing this library, of if you port this library to a different platform. Thanks for your help.

Published at 16/11/2003 16:31:13
Last Updated 08/12/2003 20:25:07
By Juan M. Casillas




Google



Setting up libthreadedserver
Introduction

Sections
LibThreadedServer

February's articles
S M T W T F S
 
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
      
More articles

Search


Other versions
XML version
Printable version

Download
Latest version is 0.45a
(18 Kb, tar.gz file)

 » from JMCResearch
Quick links
Install HOW-TO
Local CVS Repository
Ask your questions