Skip to content

A simple BitTorrent client implemented in Kotlin, with a full implementation of Bencode Parser

License

Notifications You must be signed in to change notification settings

kokoro-aya/Tiny-KTorrent

Repository files navigation

Tiny-KTorrent

FOSSA Status

This is a simple BitTorrent client written in Kotlin. The architecture is largely based on the c++ implementation by ss16118

Here are some main reference blog posts:

Currently the code works only on seeds from a site which is called AcademicTorrents (a seed from this site is provided in repo), on single file.

Compact or not compact format are supported.

It doesn't support pause and resume, multi-file or seeding, nor does it support pipeline or other advanced features.

Launch Parameters

Options Full Name Desc Misc
-s --seed Path to the Torrent seed REQUIRED
-o --output The output directory to store the downloaded file REQUIRED
-n --threadnum Number of downloading coroutines to use 8
-l --logging Enable logging false (not present in parameters)
-f --logfile The directory to store the log file ./logs/ktorrent

If no argument is supplied or wrong arguments, the help menu will be shown.

Known Issues

  • While connecting to a certain types of peers, the handshake will fail (the socket tries to read 68 bytes but it received an EOF)

  • Not all coroutines are working (if there are 3~4/8 it's already good) FIXED?

  • Timeout for TCP connection is too long

  • After downloading several pieces (around a hundred of), the program hangs and all coroutines are paused.

    This seems to be an issue related to a failed socket connection initialization. Sometimes it happens just after the program is launched but sometimes it has to wait until it's blocked.

Implemented

  • Bencode/Decode
  • Retrieve a list of peers from tracker periodically
  • Display download status
  • Download single file with multi coroutines

License

FOSSA Status

About

A simple BitTorrent client implemented in Kotlin, with a full implementation of Bencode Parser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages