Skip to content

p2p application for communication over udp sockets using custom protocol

License

Notifications You must be signed in to change notification settings

admtrv/HelloPeer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

screenshot

This project implements p2p application named Hello Peer! that allows message exchange between two nodes on a local Ethernet network. Application uses custom protocol based on UDP (User Datagram Protocol) to transfer data and maintain a connection between two devices both acting as senders and receivers.

Program Build

The program is written in C++ and uses CMake for building. A CMakeLists.txt file is included with all the settings needed to compile the program. If any dependencies are missing, CMake will prompt you.

Requirements

Before building, make sure you have these installed:

  1. CMake (v3.22+)

    • Configure and generate build files:
      sudo apt-get install cmake
  2. C/C++ Compiler

    • Required for compilation:
      sudo apt-get install gcc
  3. pthread Library

    • POSIX thread library (usually part of build-essential):
      sudo apt-get install build-essential
  4. readline Library

    • For command-line editing and history:
      sudo apt-get install libreadline-dev
  5. spdlog Library

    • Fast logging library for C++:
      sudo apt-get install libspdlog-dev

Automatic Build

Use an IDE like CLion with built-in CMake support for easy configuration (Recommended).

Manual Build

To build manually, run these commands:

mkdir build
cd build
cmake ..
make

Dependencies

CMake will notify you of missing dependencies. To install them:

sudo apt-get update
sudo apt-get install <package-name>

Replace <package-name> with the required dependency.

Running the Application

After building, start the app in two terminals:

./p2p

After launching, type help for available commands.

Example Usage

Node 1:

proc node port 5000
proc node dest 127.0.0.1:5001

Node 2:

proc node port 5001
proc node dest 127.0.0.1:5000 # i use loopback for testing

To connect:

proc node connect

To send a message:

send text Hello Peer!
send file /home/admtrv/file.txt

To disconnect:

proc node disconnect

Use exit to quit the application.

Command History

Navigate through command history using the up () and down () arrows.

Logging

Logs provide information for debugging and are available at different levels (trace, debug, info, etc.). Set the log level with:

set log level <level>

View logs during runtime with show log, or check the .logs file after termination.

Documentation

Detailed documentation and explanations are available in the doc/ directory.

About

p2p application for communication over udp sockets using custom protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published