Building and Running
Database Examples
General Examples
Socket Examples
Thread Examples
Building and Running
Each example program is in its own folder under examples_database, examples_general, examples_socket and examples_threads. The programs test one part of the library each and can be used as templates for new applications. The listings in the menu on the left are older programs kept for reference; the programs below are the ones built and tested with this release.
To build and run an example on Linux:
cd datareel/env source gnu_env.sh cd ../examples_database/simple make ./testprog
On Windows use nmake -f msvc.mak in the same folder. The SSL examples (https_client, ssl_server and ssl_verify_cert) need the library built with OpenSSL; see Linux Builds. Most test programs pause between steps and wait for Enter. string_class can be built with -D__AUTORUN_TESTPROG__ to run without prompts. All of these programs were run under AddressSanitizer and UndefinedBehaviorSanitizer for the 10/14/2026 code review.
Database Examples
Folder: examples_database
| Program | Source files | What it shows | Class |
| btree | testprog.cpp | Insert, find and delete keys with the gxBtree class. | gxbtree |
| btree_cached | testprog.cpp | The same B-tree operations through the B-tree cache. | btcache |
| btree_node | testprog.cpp | Tests the B-tree node class. | btnode |
| database | testprog.cpp | Compares the 32-bit and 64-bit database engines. | gxdbase |
| database_cache | testprog.cpp | Tests the database file cache classes. | dbfcache |
| defrag | testprog.cpp | Reclaims deleted blocks with gxDatabase::Reclaim() using the first-fit or best-fit method. | gxdbase |
| pod | testprog.cpp | Tests the Persistent Object Database (POD) manager. | pod |
| simple | testprog.cpp | A simple demo of the gxDatabase class. | gxdbase |
General Examples
Folder: examples_general
| Program | Source files | What it shows | Class |
| binary_search_tree | testprog.cpp | Tests the generic binary search tree class. Interactive menu; enter q to quit. | gxbstree |
| config_class | testprog.cpp | Reads and changes values in a text configuration file with gxConfig. | gxconfig |
| device_cache | testprog.cpp | Tests the device cache classes. | devcache |
| disk_file_class | testprog.cpp | Tests the DiskFileB file I/O class. | dfileb |
| doubly_linked_list | testprog.cpp | Tests the doubly linked list class. Shows how to free strings allocated with new[]. | gxlist |
| file_utils | testprog.cpp | Tests the file and directory utility functions. Run with a directory name: testprog /tmp | futils |
| html_parser | testprog.cpp | Tests the gxsHTML parser classes. | gxshtml |
| logfile | testprog.cpp | Tests the LogFile class. | logfile |
| memory_buffer | testprog.cpp | Tests the MemoryBuffer class. | membuf |
| string_class | testprog.cpp | Tests the gxString (UString) class, including Unicode strings. | gxstring |
| url_parser | testprog.cpp | Tests the gxsURL parser classes. | gxsurl |
| xml_parser | testprog.cpp | Loads an XML file into an in-memory tree (DOM parsing) and writes it back out. Run with a file name, or -t to write a test file: testprog testfile.xml | gxsxml |
Socket Examples
Folder: examples_socket
| Program | Source files | What it shows | Class |
| broadcast | client.cpp, server.cpp | UDP broadcast client and server. | gxsocket |
| echo_server | client.cpp, server.cpp | TCP echo client and server. | gxsocket |
| ftp_client | testprog.cpp | Tests the embedded FTP client class. | gxsftp |
| hostinfo | testprog.cpp | Gets host name information. | gxsutils |
| http_client | testprog.cpp | Tests the HTTP, HTML and URL classes. | gxshttpc |
| http_server | httpserv.cpp, httpserv.h, server.cpp | Multi-threaded HTTP server framework built on gxSocket and gxThread. | gxshttp |
| https_client | testprog.cpp | HTTPS client using the gxSSL class. Requires an SSL build. | gxssl |
| multi_threaded_server | client.cpp, m_thread.cpp, m_thread.h, server.cpp | Client and multi-threaded server using gxSocket and a thread pool. | thrpool |
| multicast | client.cpp, server.cpp | UDP client and server that join an IP multicast group and exchange datagrams. | gxsocket |
| ping | testprog.cpp | Tests the embedded ping class. | gxsping |
| pop3_client | testprog.cpp | Tests the embedded POP3 client class. | gxspop3 |
| simple | client.cpp, server.cpp | Simple TCP stream client and server. | gxsocket |
| smtp_client | testprog.cpp | Tests the embedded SMTP client class. | gxsmtp |
| socket_cache | client.cpp, gxsfile.cpp, gxsfile.h, server.cpp | Device cache client and server that move cached data over a socket. | devcache |
| ssl_server | m_thread.cpp, m_thread.h, server.cpp | Multi-threaded HTTPS server using gxSSL. Includes a sample key, certificate and 2048-bit DH parameters. Requires an SSL build. | gxssl |
| ssl_verify_cert | testprog.cpp | Client side SSL certificate verification. Requires an SSL build. | gxssl |
| tcp_send_file | tcp_send_file.cpp | Sends a file over a TCP stream socket. | gxsocket |
| telnet_client | testprog.cpp | Tests the embedded telnet client class. | gxtelnet |
Thread Examples
Folder: examples_threads
| Program | Source files | What it shows | Class |
| cancel | testprog.cpp | Cancels a long-running thread. | gxthread |
| condition | testprog.cpp | Synchronizes threads with condition variables. | gxcond |
| deadlock1 | testprog.cpp | A deadlock that gxMutex recovers from automatically. | gxmutex |
| deadlock2 | testprog.cpp | A deadlock that the application recovers from. | gxmutex |
| deadlock_posix_testing | testprog.cpp | POSIX robust mutex deadlock detection test for Linux. | thelpers |
| destroy | testprog.cpp | Destroys a thread. | gxthread |
| detach | testprog.cpp | Creates a detached thread. | gxthread |
| exiting | testprog.cpp | Exits from a thread. | gxthread |
| joined | testprog.cpp | Joins a thread. | gxthread |
| message | testprog.cpp | Thread status and error message functions. | gxthread |
| mutex | testprog.cpp | Protects shared data with gxMutex. | gxmutex |
| priority | testprog.cpp | Sets thread priorities in a thread pool. | thrpool |
| simple | testprog.cpp | Basic gxThread use with entry and exit functions. | gxthread |
| specific | testprog.cpp | Creates thread-specific data. | gthreadt |
| stack | testprog.cpp | Changes a thread's stack size. | gxthread |
| suspend | testprog.cpp | Suspends and resumes a thread. | gxthread |
| template | testprog.cpp | Uses gxThread with templates. | gxthread |
| thread_pool | testprog.cpp | Basic operation of the thread pool. | thrpool |
| timed | testprog.cpp | Synchronizes threads with timing delays. | gxthread |