Free Java Peer To Peer Chat
The Peer To Peer Chat code/programs given here were written by Devin & George Smith, over a few days. There was NO attempt, except for good class and method names, to generate any documentation. The program currently comes in two flavors:
-
P2PChatAWT - An AWT version
-
P2PChatConsole - A Console version
The code was written with a Strategy Pattern for the UI, so except for the startup/UI support code, all the code is common between the two versions. The code is heavily multi-threaded and should perform well regardless of any difference in bandwidth from one peer to the next. It uses Java's built-in Sockets.
Fundamentally, the UI (and hence the P2PChat programs) support 4 functions:
-
Who is connected
-
Name Change
-
Private Message - to a specific peer
-
Public Message - to all peers
For the Console version these functions are available as:
-
Who is connected - enter a line consisting of ONLY: WHO
-
Name Change - enter a line like (with the "..." replaced with your new chat name): I AM ...
-
Private Message - enter a line like (with the "..." replaced with the message, and "n" replace with the peer number): MSG n ...
-
Public Message - anything else (not the above)
For the AWT version these functions are available as:
-
Who is connected - shown constantly in the "Who's On:" box
-
Name Change - "enter" after typing in the "Name:" field
-
Private Message - Double Click on an entry in the "Who's On:", and a private dialog window will open
-
Public Message - "enter" after typing in the "Message to Send:" field
Download options (as .zip):
Individual Source Files:
This LiteSoft page sponsored by Smith's Net Services.