Home  +  Forums  +  C++ and Sockets  +  C++ and SQL: MySQL, sqlite, ODBC  +  Miscellaneous Projects
Logo
~Sockets~
~New~
~Examples~
~Contact~

Distributed Chat (minder/minion tech demo)

This is a distributed text chat solution, written as an example on how to use the MinderHandler/MinderSocket/MinionSocket classes of the C++ Sockets library / framework. Featuring peer list distribution over SSL and (potentially) encrypted traffic between nodes.

It opens a telnet server at port 4404. When a user opens a session, the user is prompted for which name to use.

Commands available after "login" are:

  • /quit - end session
  • /who - see who else is online
  • anything else will be sent as text

Latest version

Download dchat-1.2.tar.gz 2006-10-03 Update to sockets library v2.1

Download dchat-1.1.tar.gz 2006-04-20

Download dchat-1.1.zip 2006-04-20

dchat-1.0.tar.gz

Please note. This example was primarily developed on linux, and may require some tweaking to compile on other platforms.

Source code documentation (generated by Doxygen). Select "File List" from the doxygen index page to see a list of all files in the example. Then select "[code]" to read the source code of that file. Files beginning with lowercase are usually the main() starting point, and files beginning with uppercase usually contains a class of the same name as the file itself.

Class Diagram generated by dp
Class Diagram

Installation

To run this a working minder is necessay. I always try to have one online at "minder.alhem.net" port 9696. If not, download and install the minder from the minder project page.

For SSL operation, the minder needs a server public/private key pair. By default, those keys are loaded from the file "comb.pem". File not included in distribution, use openssl utilities to generate a key pair. https://www.openssl.org/

Minder host/port is hardcoded in dchat.cpp - make sure they are correct for the minder you want to use.

The minion connect interval is hardcoded at 60 seconds in this example. So you must wait at least one minute before other minions are contacted. Other minions may contact you earlier, though.

Minion encryption

The key.h / key.cpp files are of much more use if a custom encryption class is used instead of NullCrypt (which only base64-encodes whatever is to be sent).

Page, code, and content Copyright (C) 2021 by Anders Hedström