Skip to content

V4run14/P2P-CI-System

Repository files navigation

P2P-CI-System

CSC/ECE 573 – Internet Protocols Project

What’s Inside

  • server.py – central index server (P2S).
  • p2s.py – peer client to talk to the server (ADD/LOOKUP/LIST/LEAVE, download via GET).
  • p2c.py – peer upload server to serve RFCs (GET).
  • connect.py – interactive peer runner: registers RFCs, runs upload server, provides commands (list/lookup/download/exit) while keeping the server connection open.
  • peer_details/peerN.txt – sample peer configs (IP, port, RFC list).
  • resources/, rfc_files/, downloads/ – locations where RFC text files are served from/found.

Typical Flow (Interactive)

  1. Start the index server:
python server.py
  1. Start a peer interactively (register + upload server + shell):
python connect.py --peer 1

Commands at connect>:

  • list – show full RFC index (LIST ALL)
  • lookup <rfc> – show peers hosting that RFC
  • download <rfc> – LOOKUP → GET → save to downloads/<rfc>.txt
  • exit – LEAVE, close server connection, stop upload server

Start more peers similarly:

python connect.py --peer 2
python connect.py --peer 3

Non-Interactive Commands (existing scripts)

  • Register one peer’s RFCs from peer_details/peerN.txt (connection closes after ADDs):
python p2s.py --peer 1 --register
  • Bulk register peers 1–5 (connection closes after ADDs):
python p2s.py --bulk-register
  • Start only an upload server for a peer:
python p2c.py --peer 6
  • One-off download:
python p2s.py --peer 2 --download 791
  • One-off LIST ALL:
python p2s.py --peer 3 --list-all

RFC Files

Place text RFCs as resources/<num>.txt (or rfc_files/<num>.txt or downloads/<num>.txt) so upload servers can serve them. Example peer_details/peer6.txt:

0.0.0.0
4435
791 Internet Protocol
7727 Spanning Tree Protocol Application of Inter-Chassis Protocol Application

Protocol Summary

  • P2S: ADD/LOOKUP/LIST/LEAVE using P2P-CI/1.0 with Host/Port headers (Title for ADD). Responses include Date/OS/Server headers and body lines per RFC entry.
  • P2P GET: GET RFC <num> P2P-CI/1.0 with Host/OS headers; responses include Date, OS, Last-Modified, Content-Length, Content-Type, then file data.

Shutdown

  • Ctrl+C on server.py, p2c.py, or connect.py exits cleanly. LEAVE/disconnect removes the peer and its RFC entries from the server index.

Build/Run

  • No compile step. Use Python 3.8+.
  • Ensure you are in the project directory, then run the scripts with python (or python3 on your system), e.g.:
    • python server.py
    • python connect.py --peer 1
    • python p2c.py --peer 1
    • python p2s.py --peer 1 --register

CONTRIBUTORS

Name Unity ID
Varun Varatharajan vvarath@ncsu.edu
Krithika Swaminathan kswamin3@ncsu.edu

About

This is part of CSC/ECE 573 - Internet Protocols Project 1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages