This is a fully decentralized chat. To communicate, simply run it on computers in a single local network (using one port). All messages are encoded in UTF-16, so national characters are supported, the only restriction is the font of the console.
You can use -p
or -port
argument to select the port you want to use (The default port is 8001)
./chat.exe -port 1337
And it's cross-platform!
It was tested on Windows 7, 10, Ubuntu and Gentoo, so I can't vouch for other Unix systems and older versions of Windows. But it still should work anywhere.
The fastest and easiest way is to download the compiled files for Windows or Linux. Well, if someone wants to compile it on their own, there is CMake. It uses boost as a dependency, so make sure it's installed.
You can compile boost from sources by yourself or install it by it's installer. Cmake looks for Boost in the C:/local folder.
Use visual studio ¯_(ツ)_/¯ It works with CMake projects.
If you wish, you can also compile from the source code, but you can just download the compiled version
sudo apt-get install libboost-all-dev
git clone https://github.com/2-sha/P2P-chat.git
cd P2P-chat
cmake .
make
It is based on UDP datagrams that are sent by a broadcast request to the network and are not encrypted in any way. If you wish, you can write your client that will work correctly with mine or just view messages using wireshark or something like it. The structure of all data sent is as follows (Yes, this is JSON):
{"type": "", "data": [{"":""}] }
For example, this is information about sending a message:
{"type": "message",
"data": [
{ "user": "2sha" },
{ "content": "Hello, everybody!" }
]}
There are 5 types of data:
message
- the user sent a messageuser
- name of the user (wow)content
- the content of the message (so unexpectedly)
add_user
- someone's joined to our chatuser
- stranger's name
remove_user
- someone left our chatuser
- name of miserable
user_list_req
- someone wants to know the list of users on the network. We are obliged to respond to this messageuser_list_res
- response touser_list_req
requestuser
- our username