Coder Social home page Coder Social logo

p2p-chat's Introduction

Local P2P Chat

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.


Installation

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.

Windows

Link to compilled version

Installing Boost

You can compile boost from sources by yourself or install it by it's installer. Cmake looks for Boost in the C:/local folder.

Compilation

Use visual studio ¯_(ツ)_/¯ It works with CMake projects.

Linux

Link to compilled version

Installing Boost

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

Compilation

git clone https://github.com/2-sha/P2P-chat.git
cd P2P-chat
cmake .
make

How it works

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 message
    • user - name of the user (wow)
    • content - the content of the message (so unexpectedly)
  • add_user - someone's joined to our chat
    • user - stranger's name
  • remove_user - someone left our chat
    • user - name of miserable
  • user_list_req - someone wants to know the list of users on the network. We are obliged to respond to this message
  • user_list_res - response to user_list_req request
    • user - our username

p2p-chat's People

Contributors

2-sha avatar inexcode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

cryptobuks

p2p-chat's Issues

Rewrite on Ncurses

I independently implemented the output to the console, which may not work so reliably. It would be good to rewrite the output with Ncurses on Linux and PDcurses on Windows.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.