Socket++ Source Code and Manual
This is Socket++ version
1.10. The code was oringially developed by Gnanasekaran (Sekar) Swaminathan
(gs4t@virginia.edu), at the Department of Electrical Engineering at the
University of Virginia, a few years ago.
The Socket++ code was periodically updated, but I haven't checked for
new code in a while. The master repository was
ftp://ftp.virginia.edu/pub.
Version 1.10 does not include C++ exception handling, and it therefore
"more portable". I have compiled the libsocket++.a library on
Solaris 2.5/2.6 using both the GNU and SunPro compilers, AIX using
the GNU and IBM xlC compiler, and both Debian and RedHat Linux using
the GNU and Cygnus egcs compilers, respectively.
I also have compiled versions for Windows NT, and Windows 95 with Winsock2.
Version 1.11 has a number of changes that make it
less portable. I recommend that you use version 1.10 unless you want
to try out using exception handling, then you can try using version 1.11.
If you use version 1.11, then you will need to catch exceptions in
your mail client.
NOTE: I have fixed a bug in version 1.10 that was causing output to a socket
not to be flushed, thereby causing the client to hang. I have also made some
changes so that the code will compile and run on Windows using Winsock2. Someday,
somebody needs to go through and make the code properly use the ANSI C++ libraries,
especially the I/O streams.
If you do not want to bother with building from source code, I have precompiled libsocket++.a
libraries and packaged them up with header files for Solaris, AIX, Linux, and Windows NT.
IMPORTANT NOTE: You must pick the library that was compiled with the compiler
that you are using. You can not use a GNU C++ compiler library with either the
AIX or the Solaris C++ compilers.
Prebuilt Sockets++ For Solaris 2.5/2.6
Choose the package that corresponds to the compiler you are using:
Note: When compiling your client, just use -I<incpath> to get the header files
(e.g., smtp.h) and -L<libpath> -lsocket++ to link to the library. The incpath
and libpath could just be your project directory. You will also
need to link with two Solaris system libraries: libnsl.a and libsocket.a.
These are both in a standard place, so you should simply define LDFLAGS
in your makefile as:
LDFLAGS= -L<libpath> -lsocket++ -lsocket -lnsl
Where <libpath> is the path where you have put libsocket++.a
IMPORTANT NOTE: Make sure that in your makefile that $(LDFLAGS) follows
all the .o files when you link, otherwise you will end up with
unresolved references at link time.
Prebuilt Sockets++ for AIX 4.1
Choose the package that corresponds to the compiler you are using:
The C sockets implementation on AIX is in the standard C library, so you should only
need to use the -L<lib-path> -lsocket++ flags to the linker.
Prebuilt Sockets++ for Linux (Debian 1.3 and RedHat 5.1)
Choose the package that corresponds to the Linux system and compiler you are using:
You should not need to set LDFLAGS to anything special. If you have any problems, try
setting 'LDFLAGS = -static', to force static linking.
Sockets++ for Windows NT 4.0 and Windows 95
I have made an initial port of the core (sockstream and sockinet) Socket++
1.10 classes to Windows NT 4.0 using Winsock and the Visual C++ 5.0
compiler. This port includes the SMTP client code. I believe this port
will work on Windows 95 as well. Please let me know of any problems. I
have tested my own SMTP client program using this port over a dialup PPP
link from a Windows NT 4.0 machine to a Linux mail server running qmail.
The code is available as a zip file and contains both a VC++ 5.0 Developer
Studio project file.
The package includes a sample main.cpp file that contains code to
initialize the Winsock DLL by calling WSAStartup and making sure that
WSACleanup is called on exit. You can just copy this code verbatim.
YOU MUST INITIALIZE THE WINSOCK DLL THIS WAY. If you do not, then
your program will not work.
- Socket++ source code version 1.10 for Windows platforms using Winsock (32-bit) and Microsoft Visual C++ 6.0 - socket++-1_10MSVC6.zip using the ANSI C++ <iostream> classes.
- Socket++ source code version 1.10 for Windows platforms using Winsock (32-bit) and Microsoft Visual C++ 5.0 - socket++-1_10MSVC5.zip using the ANSI C++ <iostream> classes.
- Socket++ source code version 1.10 for Windows platforms using Winsock (32-bit) and Microsoft Visual C++ 4.2 - socket++-1_10MSVC42.zip. If you are using the 4.2 ANSI C++ iostream classes (i.e., including <iostream> instead
of <iostream.h> then
download this new sockstream.h file and replace
the one that is in the zip file.
- Socket++ source code version 1.10 for Windows platforms using
Winsock (16-bit) and Borland C++ 4.52 -
socket++-1_10Borland.zip.
Special thanks go to Fred Brown for making the changes to the VC++ port to make sockets++ work in 16-bit mode using Borland C++.
VC++ 4.x may not be able to read the VC++ 5.0 project file. If not, then you can just
create a new static library project in VC++ 4.x and add the .h and .cpp files to that
project and build. You will need to set the include path in the "options" settings
so that the .h files are picked up from your project directory.
IMPORTANT WINDOWS NOTE: I recommend that you compile the Windows version as a debuggable
multithreaded static library that can be used with DLLs (i.e., use the
/MDd flag to VC++ and define _MT as a preprocessor flag) then just link
it with your SMTP client program.
Also note that you need to modify your project linker settings to include wsock32.lib
in order to link with the Winsock2 library. You should list the SocketsPP.lib
before the wsock32.lib in your linker specification