Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.
/ trivial_torrent Public archive

This is the repository from the subject Computer Networks (Xarxes) of Universitat Autònoma de Barcelona during the academic year 2021-22, 2nd Semester.

Notifications You must be signed in to change notification settings

yeray142/trivial_torrent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trivial Torrent Project: Client and Server

Trivial Torrent Client

You need to implement the client part of the Trivial Torrent protocol. See the Trivial Torrent protocol specification document for details (section 2.3.1).

Use the file src/ttorrent.c.

The ttorrent command shall work as follows:

$ bin/ttorrent file.ttorrent

Trivial Torrent Server

Implement the server part of the Trivial Torrent protocol. See the Trivial Torrent protocol specification document for details (2.3.2).

Use the file src/ttorrent.c.

The ttorrent command shall be extended to work as follows:

$ bin/ttorrent -l 8080 file.ttorrent

Multi-client implementation strategies

The server part can be implemented using two different strategies: employing a forking server, or employing non-blocking sockets. Employing non-blocking sockets can be very challenging. Follow one of the two approaches based on your personal preferences. Follow the conservative approach if you are not sure which approach is best for you.

Approach Description
Conservative First implement the server employing a forking server model (mandatory; 70% grade), then upgrade the server to employ non-blocking sockets (optional; 30% grade).
Audacious Implement directly a server employing non-blocking sockets (100% grade).

Note: servers employing non-blocking sockets must employ a single process and must not employ threads.

Practical Details

Building

Use make in a terminal to build your project.

$ make

This will create the executable file bin/ttorrent.

Reference binary

For your convenience, a reference binary is provided in the reference_binary directory. You can use this binary as a reference server while you develop your client, and as a reference client while you develop your server.

Testing

Some preliminary tests on the trivial torrent client can be performed as follows.

In one terminal run the reference server:

$ reference_binary/ttorrent -l 8080 torrent_samples/server/test_file_server.ttorrent

In another terminal employ your client to download the file that the server is making available.

$ bin/ttorrent torrent_samples/client/test_file.ttorrent

You can compare the original and the downloaded files using cmp to make sure they are equal.

$ cmp torrent_samples/client/test_file.ttorrent torrent_samples/server/test_file_server.ttorrent

Note: this command does not output anything if both files are equal.

Additional tests may be run with:

$ make test

Note that gitlab runs make test for you every time you push something to this repository. You can see the results in the CI/CD tab.

About

This is the repository from the subject Computer Networks (Xarxes) of Universitat Autònoma de Barcelona during the academic year 2021-22, 2nd Semester.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages