The Code Factory



Welcome to the homepage of NetClass.


See the associated Sourceforge hosted NetClass Page.

NetClass - a multi-platform C++ library which provides a thin wrapper for socket and thread support. This library is available under the terms of the GNU Public License. Currently, there is support for GNU/Linux and Win32 platforms. Also included in the library is the basic architecture to quickly create a simple generic server.

NetClass is written and maintained by Neill Miller. See my personal homepage for more information about me and what I'm interested in.


For access to the CVS Web-Interface, click here.


To see some sample code (which uses threads to run a simple server and a client) using NetClass, view the sample code.
NOTE: This code has been tested on GNU/Linux and win32 platforms. For win32, you must create a project and add the source file to it. Do not forget to add the netclass.lib directory as an additional lib directory and similarly the netclass include directory as you set up your project.

Compiling netclass version 0.3.0 or later
Compiling netclass version 0.2.7 or previous


Compiling netclass version 0.3.0 or later

netclass-0.3.0 or later adds much heavier use of the autoconf/automake tools for library emission, proper installation support, and proper distribution generation.
Compiling and installing netclass:
----------------------------------

./configure && make && make install

Standard compilation and installation options are now properly
supported.


Including netclass into your projects:
--------------------------------------

To add the netclass libraries and header files to your existing
autoconf/automake based project, add the following lines to your main
configure.in file:

dnl ----------------------------------
dnl start netclass related checks here
dnl ----------------------------------
NETCLASS_PATH=""

AC_ARG_WITH(netclass,
            [  --with-netclass=DIR     path to installed netclass package],
            NETCLASS_PATH=$withval,
            NETCLASS_PATH="/usr/local")

AC_CHECK_FILE("$NETCLASS_PATH/include/netclass.h", ,
              AC_MSG_ERROR("cannot find netclass.h header file."))

AC_CHECK_FILE("$NETCLASS_PATH/lib/libnetclass.la", ,
             AC_MSG_ERROR("cannot find netclass library."))

AC_SUBST(NETCLASS_PATH)

dnl this is required if NetClass threads are desired
AC_DEFINE(HAVE_THREADS)

AC_CHECK_FUNCS(gethostbyname socket inet_aton inet_addr \
               inet_pton poll select strerror)
dnl ----------------------------------
dnl end netclass related checks here
dnl ----------------------------------

Now that the NETCLASS_PATH variable has been defined, output it in
each Makefile.am which needs to use either the netclass includes or
library files.  An example includes the following:

INCLUDES = -I@NETCLASS_PATH@/include

main_LDADD = -L@NETCLASS_PATH@/lib -lnetclass


Having all of this in your project, allows flexibility.  The user can
install netclass at any location and simply tell your application
where netclass is installed for linking and including purposes.

A note on licensing:
--------------------

The netclass project is Free Software released under the terms of the
GNU General Public License (GPL).  What this mean for you is that any
code that you write using the library must also be released under the
GPL in order to avoid breaching the netclass license.  The netclass
project is NOT under a BSD-styled license allowing you to use it without
releasing your code, nor under an LGPL license allowing closed use of
netclass in your code with only public releases of modified parts of
the netclass code base.  As a developer, I value the Freedom the GPL
provides.  Don't take it away from me and others that enjoy it.  If
you can't live with this kind of Freedom, please consider using an
alternative library.  Contact me at neillm@thecodefactory.org if
you're unsure of how you can or can't use netclass in your projects.



Compiling netclass version 0.2.7 or previous

To compile this older code under Linux, you need to have the NetClass static library built. To do this, get the latest version of the code using
CVS, or by downloading the latest release. Once you have the source (netclass.tar.gz) file, type the following:
tar -xvzf netclass.tar.gz
cd netclass
./configure
make
[NOTE: the "make install" step is not required]
I've included a source tarball of the sample code which might help get you started in using NetClass in your own projects. It is a simple source tree which uses the GNU/automake tools for building.

Get the sample project
Extract this project in the same directory where you previously extracted the NetClass library so that you have the following two directories in the same directory:
$ ls
netclass
netclass-test
$
Now, build the NetClass test program by doing the following:
cd netclass-test
./configure
make
[NOTE: There is no "make install" step]
And finally, run the sample program by doing the following:
cd netclass-test/src
./main


For any NetClass related discussion/bugs/patches/etc., try the mailing list (includes archives).


To get the code via anonymous CVS, instructions are here.

SourceForge Logo


Contact: Webmaster@thecodefactory.org