Skip to content

Instantly share code, notes, and snippets.

@maximilianfalco
Last active February 8, 2025 13:09
Show Gist options
  • Save maximilianfalco/f629775d47e084f7731c16fda121c47a to your computer and use it in GitHub Desktop.
Save maximilianfalco/f629775d47e084f7731c16fda121c47a to your computer and use it in GitHub Desktop.
Bit-Trickle README

bit-trickle 🚀

BitTrickle is an assignment submission for COMP3331 Computer Networks and Application.

BitTrickle is a user application that enables user file sharing using a P2P architecture. A server is also constructed, which mainly handles peer details and file storage. Communication between the server and client are done through UDP while peer-to-peer connections are managed using TCP. Custom headers and commands are in place to ensure that the systems works as intended.

Here are the following commands available to the client:

  • get <filename>
  • lap
  • lpf
  • sch <substring>
  • pub <filename>
  • unp <filename>
  • xit

The GET command queries the server for the address of any active users who have published the desired file, specified in the filename argument. Creating the TCP connection is handled-client side and is done automatically after receiving the address of the peer from the server.

The LAP command queries the server for ALL other active users besides the requesting users.

The LPF command queries the server for ALL files the user has published.

The SCH command queries the server for all files that contain the specified substring that is NOT owned by the requesting user.

The PUB and UNP commands are publish and unpublish. This allows the client to inform the server of the file that it has and would like to share to other peers. Note that no actual file transfer is happening here, it assumes that the uploading client has the file and can read and access it.

The XIT command exits the client application gracefully.

Extra Notes 📒

The client boasts a multithreaded approach, where the user can simultaneously upload a file to another peer while also downloading a file from another peer. Another thread is also created to continuously 'ping' the server. This mechanism is called heartbeat mechanism and is responsible for labelling the users as active.

Sample Output

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment