If youre looking for help on how to program for the Internet, theres an obvious place to go.
Web pages that document a library or tool and include hot links to its C/C++ source code
Detailed documentation concerning an important API or protocol
Web pages that organize, categorize, or rank the best freeware and shareware libraries and tools for use with C/C++
Focus on Internet Development
BSD UNIX sockets have been growing in popularity since their first appearance in the 4.1cBSD UNIX release for DEC VAX-11 in 1982. Today, sockets can be found in nearly all BSD derivatives and even in MS-Windows. BSD sockets emulate file descriptors as an extension of the UNIX file I/O system. Accordingly, you can call the standard library functions, such as read and write, to receive and transmit data. Since network communications requires more control than the file descriptor functions alone can provide, several new functions were added. For example, establishing a connection requires details about hosts, ports, protocols, and other options that simply cannot be expressed by open alone. For a brief overview of BSD sockets, see "Programming with Sockets," by Marco Tomassini in the September 1991 issue of The C Users Journal, Vol. 9, No. 9, pp. 39-56.
Socket++, by Gnanasekaran Swaminathan (Centreville, VA), is an iostream-like class for UNIX and inet sockets, pipes, and socketpairs. Socket++ classes can be used more effectively than directly calling the underlying low-level system functions. Since Socket++ has the same interface as the LibG++ iostream (i.e. like cout and cin), it automatically performs type-safe input and output. Even though Socket++ is very easy to use, it still supports a full complement of socket options including: error reporting, debug mode, keepalives, routing, broadcast datagrams, out-of-band data, and buffer resizing. Socket++ includes a mechanism for handling timeouts gracefully as well. Socket++ runs on many UNIX platforms including Sun Sparc, IBM RS/6000, DECstation, and SGI Indigo boxes.
I recently wrote to Swaminathan and asked him if he had any plans to port Socket++ to Windows NT. He replied that he didnt have access to Windows NT but that anyone who volunteered to do the port would be welcome. If you would like to do the port, please write to <sekar@nexen.com> (Gnanasekaran Swaminathan).
ftp://ftp.virginia.edu/pub/socket++-1.10.tar.gz
Since the introduction of Windows 95, the first version of MS-Windows to ship Windows Sockets (Winsock) out-of-the box, there has been a tremendous groundswell of Internet applications for the PC. The success of the Winsock standard is also due to the multi-vendor Winsock Committee which tailored a uniform Windows derivation out of the BSD UNIX standard.
The "WinSock Software Development Tools" page maintained by Harold A. Driscoll <winsock@driscoll.chi.il.us> of the Chicago Computer Society pulls together many of the diverse freeware and shareware Winsock application toolkits now available. Though sockets are an important part of Internet development, the real meat of an application lies in its implemention of key Internet protocols. Tools listed on Driscolls page support the gamut of protocols, including: Telnet, FTP, RSH (Remote SHell), RCP (Remote Copy) and others. Many of these can be used with C, C++, and VisualBasic.
Çhttp://www.ccs.org/winsock/devel.html#devel
The very latest trend in Internet development tools is of course the ActiveX platform for Windows 95 and Windows NT. Microsofts "Activex" (the API formerly known as "OLE Controls" or "OCX") provides a clean and easy-to-use method of dynamically accessing controls on web browsers. In this case, a control is any child window which can display data obtained over the web. Typical examples include Virtual Reality Markup Language (VRML) viewers and real-time audio players. For the best ActiveX applications (and the best overall assortment of Winsock apps), visit Forest Strouds legendary "Consummate Winsock Applications" page. This site is one of the few bookmarked pages on my browser:
http://papa.indstate.edu:8888/CWSApps/95activx.html
Developers wanting to produce their own ActiveX controls for web browsers should proceed immediately to the Microsoft "ActiveX Resource Area." Here you can register as an ActiveX developer, download free SDKs for both Windows and Macintosh, and read all the required background material:
http://www.microsoft.com/activex/
Focus on Debugging/Testing
The Debug Malloc Library (dmalloc) library has been designed as a drop-in replacement for the systems malloc, realloc, calloc, free, and other memory management routines while providing powerful debugging facilities configurable at run time. These facilities include such things as memory-leak tracking, fencepost write detection, file/line number reporting, and general logging of statistics. The library is highy portable and claims usability on least the following operating systems: AIX, BSDI, DG/UX, HPUX, Irix, Linux, MS-DOS, OSF, Solaris, SunOS, and Ultrix. dmalloc is distributed as shareware and requires a $35 fee for use beyond the evaluation period. See:
http://www.letters.com/dmalloc/
TracePlus32/Winsock actually fulfills both the focus on Internet and on debugging. TracePlus32/Winsock along with TracePlus32/ODBC, and TracePlus32/SQLServer are three API spy utilities which display all API calls from applications to the Windows Sockets (see Fig. 1), Open DataBase Connectivity (ODBC), and MS SQLServer APIs respectively. Whether youre calling these API functions directly, using a third-party library, or simply trying to reverse-engineer an application, youll find them invaluable. In some cases, such as debugging a client/server application with a UNIX database server, you may wish to run both TracePlus/Winsock and TracePlus/ODBC simultaneously. All of the TracePlus utilities provide extremely flexible customization at a fraction of the cost of similar commercial products.
http://www.sstinc.com/sstinc/
ftp://uiarchive.cso.uiuc.edu/pub/systems/pc/winsite/winnt/netutil/tpwins32.zip
TracePlus and many other great programming tools are featured in my book entitled Windows Programming with Shareware Tools.
http://www.HAL9K.com/book
C/C++ Mailbag
If you would like to share some of your favorite C/C++ sources, please write to me. Also if you cant find the sources you think should be out there on the WWW, write me and I may be able to help. You can e-mail me (a.k.a. "the C/C++ Answer Man") at sysop@HAL9K.com. Heres a sampling of queries which have come to me recently via e-mail.
sam.chow@analog.com (Samuel Chow) writes:
"Dear CUG,
I am writing a file parser and I was wondering if there are anything out there that could help me in this quest.
I greatly appreciate any references that you may have. Thanks in advance."
C/C++ Answer Man:
Ill assume that you want to parse ASCII files. In this case, your best alternative is the GNU BISON parser generator. This parser generator is a greatly enhanced tool which is downwardly compatible with the classic UNIX YACC. There is also a version of BISON++ available for C++ purists. There are many books available which will instruct you on the uses of YACC family parser generators, including Compilers: Principles, Techniques, and Tools, by Aho, Sethi, and Ullman (yes, the "dragon book").
BISON ftp://prep.ai.mit.edu/pub/gnu/bison-1.25.tar.gz
BISON++ ftp://ftp.th-darmstadt.de/pub/programming/languages/C++/tools/flex++bison++/
dwallis@fabius.com wrote:
" [I want] C/C++ Source code for a text editor under Windows (with syntax highlighting capability)."C/C++ Answer Man:
Your best choice would be the EMACS v19.17 Windows NT port. This distribution includes binaries for Intel, MIPS, and Alpha CPUs as well. Complete source code is available in a separate archive file. People either love or hate EMACS, youll never know which until you try it yourself!
ftp://ftp.cdrom.com/pub/cica/winnt/misc/emacs.zip
ftp://ftp.cdrom.com/pub/cica/winnt/misc/emacssrc.zip
aradclif@spacecom.af.mil (Adam Radcliff) writes:
" I was wondering if you have a free version of C++ that you could email me."C/C++ Answer Man:
A reasonable request, however the GNU C++ compiler is simply too big for even the most robust e-mail program (being somewhat bigger than 10 megabytes). You didnt say what platform, so I assume you meant Intel PC computers. Try:
http://www.delorie.com/djgpp/
KraigO@AOL.COM writes:
I am familiar with you from your shareware column in Windows Developers Journal and Im wondering if you can point me in the right direction. In a perfect world I would be able to find a shareware library for MFC 2.5 that implements an ISAM database derived from CFile. Of course I expect to find nothing so wonderful, but perhaps you can point me in a direction that will get me part of the way there.
Thanks for reading this and in advance for any help you can give me.
C/C++ Answer Man:
For straight ISAM functionality, I recommend Nildrams ISAM Manager. ISAM Manager is a database management library for C++ programmers. It offers a complete and efficient ISAM system with B+Tree indexes that provides a very straightforward interface to the developer. ISAM Manager can handle very large and complex applications: up to 2 billion records per file, 30 indexes per file, and 10 fields per index. ISAM Manager is available in single-user (stand-alone) and multi-user (network file sharing) configurations. Internal index caching (single-user version only) allows the most recently used indexes to stay in memory. ISAM Manager also includes a program generator to produce default data entry screens. It is highly portable and has been compiled and tested on MS-DOS, Windows, and OS/2.
http://www.nildram.co.uk/nildram/isam.html
You might also consider MetaKit for persistent data storage. MetaKit is a compact class library for data storage and easy manipulation of structured objects and collections in C++. MetaKit works with any C++ compiler that supports Microsoft Foundation Classes, including VC++, Borland C++, and Symantec C++. MetaKit allows your data to be loaded on demand, which allows you access to any size files. It uses traditional database metaphors of begin work/commit work/rollback work with automatic file storage allocation and reclamation. MetaKit allows data to be "flattened" for efficient streaming over sockets and pipes. It encapsulates data in terms of view, row, and property classes. Data can be conveniently accessed via [] and () by operator overloading. Applications can statically link MetaKit or load it as a DLL. MetaKit does not use ISAM or B+Trees, however it uses intelligent flat-file management with adaptive denormalization to achieve ISAM speeds.
http://www.meta4.com/meta4/metakit.htm
bleeker@cww.de writes:
hi,
i am a student from germany and at the beginning i must tell you that my english is very bad. Anyway i hope you can understand me!!! well, im looking for the game "scrabble" written in the source-code "C" for running by the microsoft-compiler but my searching wasnt successful up to now! Maybe you can help me?!?
C/C++ Answer Man:
For some great Scrabble information including clubs, helper software, live games on the Internet, and more see
http://personal.riverusers.com/~thegrendel/scrab.html
By far the most portable and complete implementation of Scrabble is Chapman and Badhams XScrabble. This is a full multiplayer (1-4) implementation of the classic board game, with multilevel computer players, and 114,000 word dictionary (the Official Scrabble Players Dictionary.) Features include high score table, handy setup window, and load/save facilities. This program requires X-Windows; a port to Linux should be available by the time you read this (The source code is available too).
http://www.belgarath.demon.co.uk/programs/index.html