Skip to content

gistrec/C-P2P-Chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C P2P Chat

English | Русский

Build

A decentralized peer-to-peer chat written in C, built on top of UDP with non-blocking I/O.

Features:

  • Connect to a single peer and the chat automatically discovers and joins the rest of the network.
  • Activity tracking — peers that stop answering pings are considered disconnected.
  • Pseudo-graphical Midnight Commander–style interface, with colors and message timestamps.
  • Per-user nicknames (up to 12 characters).
  • Messages limited to 60 characters, with a live counter shown above the input.
  • Slash commands: /help, /who, /clear, /quit.

Screenshot


Dependencies

  • ncurses — terminal I/O library (the wide-character build, ncursesw, is required).
  • CMake ≥ 3.10.

Build

git clone --depth=1 https://github.com/gistrec/C-P2P-Chat.git
cd C-P2P-Chat
cmake -S . -B build
cmake --build build -- -j 2

Installing dependencies

Ubuntu / Debian:

sudo apt-get install cmake libncursesw5-dev

macOS (Homebrew):

brew install cmake ncurses

More details: installing ncurses, installing CMake.

Usage

Flag Description
-n, --name <nick> Nickname (required)
-l, --local-port <port> Local port (default 8888)
-r, --remote-host <ip> IP of a peer to connect to
-p, --remote-port <port> Peer port (default 8888)
-h, --help Show usage

Example:

./build/C_P2P_Chat --name Alice --remote-host 46.180.227.50 --remote-port 8888 --local-port 8080

Roadmap

  • Chat commands.
  • Color support.

About

Decentralized P2P chat in C — UDP-based, non-blocking I/O, auto-discovery of peers, ncurses TUI

Topics

Resources

License

Stars

Watchers

Forks

Contributors