CSC/ECE 573 – Internet Protocols Project
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.
- Start the index server:
python server.py
- 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 RFCdownload <rfc>– LOOKUP → GET → save todownloads/<rfc>.txtexit– LEAVE, close server connection, stop upload server
Start more peers similarly:
python connect.py --peer 2
python connect.py --peer 3
- 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
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
- P2S: ADD/LOOKUP/LIST/LEAVE using
P2P-CI/1.0with 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.0with Host/OS headers; responses include Date, OS, Last-Modified, Content-Length, Content-Type, then file data.
- Ctrl+C on
server.py,p2c.py, orconnect.pyexits cleanly. LEAVE/disconnect removes the peer and its RFC entries from the server index.
- No compile step. Use Python 3.8+.
- Ensure you are in the project directory, then run the scripts with
python(orpython3on your system), e.g.:python server.pypython connect.py --peer 1python p2c.py --peer 1python p2s.py --peer 1 --register
| Name | Unity ID |
|---|---|
| Varun Varatharajan | vvarath@ncsu.edu |
| Krithika Swaminathan | kswamin3@ncsu.edu |