SlideShare a Scribd company logo
BitTorrent on iOS
Michael Caylus / Simone Civetta
12/01/2017
Michael Simone
Quiz
‘How many of you need to
sync large quantity of files
periodically?’
BitTorrent
BitTorrent on iOS
BitTorrent on iOS
Designed: April 2001
First released: July 2001 Bram Cohen
A
Peer-To-Peer Protocol
#1 usage:
Sharing Large Media Files
170M active users* 40% of all Internet traffic**
10 popular clients
uTorrent, Xunlei, Transmission, Vuze, qBittorent,
Deluge, BitComet and Tixatit
* Wikipedia
CompaniesPiracy
** BitTorrent Inc.
Facilitates transfer of large/multiple files
Works on unreliable network connections
Downloads can be resumed any time
✔
✔
✔
In Detail
Basics
Files are
shared among
the users
Files to be shared
are split in
multiple chunks
Peers
contribute
Torrent (metadata)
Pieces / Segment
Swarm
Peers / Leechers
Seeds
Trackers
Stakeholders
Metainfo file (bencoded dictionary)
Torrent File
ANNOUNCE
Announce URL of the tracker
PIECE LENGTH
INFO
Dictionary describing the files’ chunks
PIECES (20-byte SHA1 Hash Values)
LENGTH
NAME
PIECE LENGTH
PIECES (20-byte SHA1 Hash Values)
NAME
FILES
LENGTH
PATH
Always-available seed
Firewall-friendly stream
Easy-to-manage service
Our Challenges
!
!
!
Torrent (metadata)
Pieces / Segment
Swarm
Peers / Leechers
Seeds
Trackers
WebSeed
2
WebSeed
Similar to HTTP direct download
Guarantees availability of resources
Independent of swarm sanity
Extension on bitTorrent protocol
Introduced in 2006
Quiz
‘How many of you have
already developed a
BitTorrent client?’
libtorrent
BitTorrent OSS Implementation
Developed by Arvid Norberg, since 2003
Written in C++, Cross Platform
Memory/CPU efficient, feature-packed
✔
✔
✔
✔
libtorrent
Pros
Easily configurable
Supports trackerless mode, with
DHT
Supports Web Seeds (i.e. a seed can
be a HTTP host), and SSL Torrents
Supports Local Service Discovery
Pros and Cons
Cons
No CocoaPods/Carthage distribution
Depends on other libraries
Not based on URLConnection
Does not support iOS background
sessions
Alternatives
MultiPeer
Connectivity
Couchbase Realm
Alternatives
Alternatives: Pros
MultiPeer
Connectivity
Couchbase
It’s a real DB
Sync based on
NSURLSession
Supports MPC
Realm
It’s a real DB
Sync based on
NSURLSession
Native
Supports
Bluetooth
Alternatives: Cons
MultiPeer
Connectivity
Couchbase
Depends on a
proprietary stack
Doesn’t work
with chunks
Realm
Depends on a
proprietary stack
No real P2P
8 devices per
session
Manual handling
of chunks
How to Build
OpenSSL
Boost C++ TLS/SSL and crypto C library
Requirements
How to Build
https://github.com/xebia-france/libtorrent-ios-resources
Option A: Pre-configured Xcode Project
- https://github.com/chublix/libtorrent-ios
- Adapt for OpenSSL
Option B: Qt Creator
- Build OpenSSL and Boost separately
- Build libtorrent, for all the platforms (e.g. iphoneos and iphonesimulator)
- lipo (i.e., merge the slices) of the different platforms
Option C: Bash Script
- cf. xebia-france/libtorrent-ios-resources/build-script
Sources
Popcorn Time iOS
https://github.com/danylokostyshyn/popcorntime-ios
Popcorn Time TV:
https://github.com/PopcornTimeTV/PopcornTimeTV
Popcorn Torrent:
https://github.com/PopcornTimeTV/PopcornTorrent (GCD WebServer / Torrent client for iOS)
Configuration
Configuration
session_settings settings = ses.settings();
settings.ssl_listen = 4443;
settings.active_loaded_limit = 1;
settings.max_peerlist_size = 10;
settings.min_announce_interval = 30;
settings.urlseed_wait_retry = 10;
ses.set_settings(settings);
// http://libtorrent.org/reference-Settings.html
settings.local_service_announce_interval = 30;
settings.active_lsd_limit = 1;
// ...
ses.start_lsd();
// ...
ses.stop_lsd();
Configuration (Local Service Discovery)
How Incremental
Download Works
How Incremental Download Works
No modification in the content: No Download
Modification in the content referenced changed: Download Starts
The SHA1 of each chunk is compared to the version on disk:
Implementation
C++ / Swift Bridging
03
04
01
02 Add wrapper class’s header file into bridging header
Implement a wrapper class in .mm file (Obj C++ )
Use wrapper class in Swift03
C++ / Swift Bridging
02 Implement a wrapper class
Wrapper Class (Header)
#import <Foundation/Foundation.h>
@interface LibTorrentWrapper : NSObject {
- (void)initSession:(NSInteger)fromPort toPort:(NSInteger)toPort;
- (void)addNewTorrentFromFile:(NSString *)filePath;
}
C++ / Swift Bridging
02 Implement a wrapper class
Wrapper Class (Implementation)
@interface LibtorrentWrapper()
@property libtorrent::session *session;
@end
@implementation LibtorrentWrapper
- (void)initSession:(NSInteger)fromPort toPort:(NSInteger)toPort {
self.session = new libtorrent::session();
session_settings settings = self.session->settings();
// Apply Settings here...
self.session->set_settings(settings);
libtorrent::error_code ec;
self.session->listen_on(std::make_pair(fromPort, toPort), ec)
}
C++ / Swift Bridging
02 Implement a wrapper class
Wrapper Class (Implementation)
//...
- (void)addNewTorrentWithData:(NSData *)data {
libtorrent::add_torrent_params params;
params.save_path = // Some dir...
libtorrent::error_code ec;
params.ti = new libtorrent::torrent_info((const char*)data.bytes, data.length, ec);
self.session->add_torrent(params, ec);
}
@end
C++ / Swift Bridging
02 Implement a wrapper class
Invoke Wrapper Class in Swift
func startTorrentSession() {
var torrentWrapper = LibtorrentWrapper()
torrentWrapper.initSession(6881, toPort: 6889)
torrentWrapper.addNewTorrentWithData(/* Some Data */)
}
Event loop
03
04
01
02 Pop alert events each time callback is invoked
Set-up a timer that triggers a callback periodically
Feed torrent progress info03
Fetch alerts
- (void)fetchAlerts {
std::deque<alert *> deque;
_session->pop_alerts(&deque);
for (std::deque<alert *>::iterator it=deque.begin(); it != deque.end(); ++it) {
std::unique_ptr<alert> alert(*it);
switch (alert->type()) {
case metadata_received_alert::alert_type:
//**
case piece_finished_alert::alert_type:
//** You can feed progress info here
case torrent_finished_alert::alert_type:
//**
default: break;
}
}
deque.clear();
}
Fetch torrent progress info
- (dl_info)getCurrentTorrentInfo:(piece_finished_alert *)alert {
dl_info result;
torrent_handle t = alert->handle;
try {
t->get_torrent_info();
} catch (libtorrent_exception &e) {
return result;
}
torrent_status ts = t->status(torrent_handle::query_pieces);
result.seeders = ts.num_seeds;
result.peers = ts.num_peers;
result.downloadRateBs = ts.download_rate;
result.uploadRateBs = ts.upload_rate;
torrent_info ti = t->get_torrent_info();
result.downloaded = ts.total_done;
result.progress = ts.progress_ppm;
result.completed_time = ts.completed_time;
return result
}
Caveats
Caveats
1 Needs fine tuning, i.e. for avoiding heavy
battery consumption
No background sessions
Almost no iOS help resource available
System proxy support to be manually
implemented (via
CFNetworkCopySystemProxySettings)
2
3
4
BitTorrent on iOS
BitTorrent on iOS

More Related Content

PDF
SwiftyGPIO
PDF
PDF
Dockerizing Symfony Applications - Symfony Live Berlin 2014
 
PPTX
Deploying Symfony2 app with Ansible
PDF
Getting instantly up and running with Docker and Symfony
PPTX
Dockerizing a Symfony2 application
PPTX
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
PDF
Dessi docker kubernetes paas cloud
SwiftyGPIO
Dockerizing Symfony Applications - Symfony Live Berlin 2014
 
Deploying Symfony2 app with Ansible
Getting instantly up and running with Docker and Symfony
Dockerizing a Symfony2 application
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Dessi docker kubernetes paas cloud

What's hot (20)

PPTX
PHP development with Docker
PDF
CocoaHeads Rennes #13 : CocoaPods
PDF
Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Dock...
PDF
Dockerize your Symfony application - Symfony Live NYC 2014
PDF
Infrastructure Deployment with Docker & Ansible
PDF
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
PDF
Docker deploy
PDF
The state of the swarm
PDF
Docker 101 - from 0 to Docker in 30 minutes
PPTX
Intro- Docker Native for OSX and Windows
PPTX
Docker orchestration
PDF
CoreOS Overview
PDF
Running Django on Docker: a workflow and code
PDF
Continuous Integration: SaaS vs Jenkins in Cloud
PDF
Multi-provider Vagrant and Chef: AWS, VMware, and more
PDF
Continuous integration with Docker and Ansible
PDF
Create your very own Development Environment with Vagrant and Packer
PDF
Install openstack
PDF
Node.js essentials
PDF
Develop QNAP NAS App by Docker
PHP development with Docker
CocoaHeads Rennes #13 : CocoaPods
Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Dock...
Dockerize your Symfony application - Symfony Live NYC 2014
Infrastructure Deployment with Docker & Ansible
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
Docker deploy
The state of the swarm
Docker 101 - from 0 to Docker in 30 minutes
Intro- Docker Native for OSX and Windows
Docker orchestration
CoreOS Overview
Running Django on Docker: a workflow and code
Continuous Integration: SaaS vs Jenkins in Cloud
Multi-provider Vagrant and Chef: AWS, VMware, and more
Continuous integration with Docker and Ansible
Create your very own Development Environment with Vagrant and Packer
Install openstack
Node.js essentials
Develop QNAP NAS App by Docker
Ad

Viewers also liked (20)

PDF
Comment faire de HLS votre solution vidéo préférée ?
PDF
Un retour d'expérience sur Apple Pay
PDF
Monads in Swift
PDF
Découvrir dtrace en ligne de commande.
PDF
Tout savoir pour devenir Freelance
PDF
Super combinators
PDF
Firebase par nicolas lehovetzki
PDF
Introduction to WebRTC on iOS
PDF
Safari app extensions cleared up by Sanaa Squalli
PDF
Make Acccessibility Great Again
PDF
Présentation de HomeKit
PDF
IoT Best practices
PDF
Advanced functional programing in Swift
PDF
L'intégration continue avec Bitrise
PPTX
La sécurité sur iOS par Arnaud de Bock
PDF
MVC-RS par Grégoire Lhotelier
PDF
Project Entourage
PDF
CloudKit as a backend
PDF
Quoi de neuf dans iOS 10.3
PDF
Handle the error
Comment faire de HLS votre solution vidéo préférée ?
Un retour d'expérience sur Apple Pay
Monads in Swift
Découvrir dtrace en ligne de commande.
Tout savoir pour devenir Freelance
Super combinators
Firebase par nicolas lehovetzki
Introduction to WebRTC on iOS
Safari app extensions cleared up by Sanaa Squalli
Make Acccessibility Great Again
Présentation de HomeKit
IoT Best practices
Advanced functional programing in Swift
L'intégration continue avec Bitrise
La sécurité sur iOS par Arnaud de Bock
MVC-RS par Grégoire Lhotelier
Project Entourage
CloudKit as a backend
Quoi de neuf dans iOS 10.3
Handle the error
Ad

Similar to BitTorrent on iOS (20)

PDF
Oscon presentation
PPTX
Filesharing using bittorrent protocol
PPTX
Introduction to the Bittorrent Protocol
PPTX
Bit torrent protocol seminar by Sanjay R
PPTX
Bit torrent a revolution in p2p
PPTX
iOS Application Exploitation
PDF
Bit sync personal_cloud
PDF
How do I - Networking and Webservices - Transcript.pdf
PPT
Torrent Seminar inc.- working, terms, details
PDF
Learn to love networking on iOS
PDF
2012 04-19 theory-of_operation
PDF
Deploy your own P2P network
PPT
Bittorrent
PDF
Introducing MQTT
PPTX
Peer to peer system
KEY
iPhone project - Wireless networks seminar
PDF
Multipeer Connectivity
PPTX
Bit Torrent technology
PDF
Messaging for the Internet of Awesome Things
Oscon presentation
Filesharing using bittorrent protocol
Introduction to the Bittorrent Protocol
Bit torrent protocol seminar by Sanjay R
Bit torrent a revolution in p2p
iOS Application Exploitation
Bit sync personal_cloud
How do I - Networking and Webservices - Transcript.pdf
Torrent Seminar inc.- working, terms, details
Learn to love networking on iOS
2012 04-19 theory-of_operation
Deploy your own P2P network
Bittorrent
Introducing MQTT
Peer to peer system
iPhone project - Wireless networks seminar
Multipeer Connectivity
Bit Torrent technology
Messaging for the Internet of Awesome Things

More from CocoaHeads France (14)

PDF
Mutation testing for a safer Future
PDF
iOS App Group for Debugging
PDF
Asynchronous swift
PDF
Visual accessibility in iOS11
PDF
My script - One year of CocoaHeads
PDF
Ui testing dealing with push notifications
PDF
CONTINUOUS DELIVERY WITH FASTLANE
PDF
Design like a developer
PDF
Programme MFI retour d'expérience
PDF
How to communicate with Smart things?
PDF
Build a lego app with CocoaPods
PDF
Let's migrate to Swift 3.0
PDF
What's new in iOS9
PDF
J'ai fait une app native en React Native
Mutation testing for a safer Future
iOS App Group for Debugging
Asynchronous swift
Visual accessibility in iOS11
My script - One year of CocoaHeads
Ui testing dealing with push notifications
CONTINUOUS DELIVERY WITH FASTLANE
Design like a developer
Programme MFI retour d'expérience
How to communicate with Smart things?
Build a lego app with CocoaPods
Let's migrate to Swift 3.0
What's new in iOS9
J'ai fait une app native en React Native

Recently uploaded (20)

PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
medical staffing services at VALiNTRY
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Transform Your Business with a Software ERP System
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Nekopoi APK 2025 free lastest update
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
ai tools demonstartion for schools and inter college
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
AI in Product Development-omnex systems
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Understanding Forklifts - TECH EHS Solution
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
top salesforce developer skills in 2025.pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Upgrade and Innovation Strategies for SAP ERP Customers
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
medical staffing services at VALiNTRY
How to Choose the Right IT Partner for Your Business in Malaysia
Transform Your Business with a Software ERP System
Wondershare Filmora 15 Crack With Activation Key [2025
CHAPTER 2 - PM Management and IT Context
VVF-Customer-Presentation2025-Ver1.9.pptx
Nekopoi APK 2025 free lastest update
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
ai tools demonstartion for schools and inter college
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
How Creative Agencies Leverage Project Management Software.pdf
AI in Product Development-omnex systems
Which alternative to Crystal Reports is best for small or large businesses.pdf
Understanding Forklifts - TECH EHS Solution
2025 Textile ERP Trends: SAP, Odoo & Oracle
top salesforce developer skills in 2025.pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025

BitTorrent on iOS

  • 1. BitTorrent on iOS Michael Caylus / Simone Civetta 12/01/2017
  • 4. ‘How many of you need to sync large quantity of files periodically?’
  • 8. Designed: April 2001 First released: July 2001 Bram Cohen A Peer-To-Peer Protocol #1 usage: Sharing Large Media Files
  • 9. 170M active users* 40% of all Internet traffic** 10 popular clients uTorrent, Xunlei, Transmission, Vuze, qBittorent, Deluge, BitComet and Tixatit * Wikipedia CompaniesPiracy ** BitTorrent Inc.
  • 10. Facilitates transfer of large/multiple files Works on unreliable network connections Downloads can be resumed any time ✔ ✔ ✔
  • 12. Basics Files are shared among the users Files to be shared are split in multiple chunks Peers contribute
  • 13. Torrent (metadata) Pieces / Segment Swarm Peers / Leechers Seeds Trackers Stakeholders
  • 14. Metainfo file (bencoded dictionary) Torrent File ANNOUNCE Announce URL of the tracker PIECE LENGTH INFO Dictionary describing the files’ chunks PIECES (20-byte SHA1 Hash Values) LENGTH NAME PIECE LENGTH PIECES (20-byte SHA1 Hash Values) NAME FILES LENGTH PATH
  • 16. Torrent (metadata) Pieces / Segment Swarm Peers / Leechers Seeds Trackers WebSeed
  • 17. 2 WebSeed Similar to HTTP direct download Guarantees availability of resources Independent of swarm sanity Extension on bitTorrent protocol Introduced in 2006
  • 18. Quiz
  • 19. ‘How many of you have already developed a BitTorrent client?’
  • 21. BitTorrent OSS Implementation Developed by Arvid Norberg, since 2003 Written in C++, Cross Platform Memory/CPU efficient, feature-packed ✔ ✔ ✔ ✔ libtorrent
  • 22. Pros Easily configurable Supports trackerless mode, with DHT Supports Web Seeds (i.e. a seed can be a HTTP host), and SSL Torrents Supports Local Service Discovery Pros and Cons Cons No CocoaPods/Carthage distribution Depends on other libraries Not based on URLConnection Does not support iOS background sessions
  • 25. Alternatives: Pros MultiPeer Connectivity Couchbase It’s a real DB Sync based on NSURLSession Supports MPC Realm It’s a real DB Sync based on NSURLSession Native Supports Bluetooth
  • 26. Alternatives: Cons MultiPeer Connectivity Couchbase Depends on a proprietary stack Doesn’t work with chunks Realm Depends on a proprietary stack No real P2P 8 devices per session Manual handling of chunks
  • 28. OpenSSL Boost C++ TLS/SSL and crypto C library Requirements
  • 29. How to Build https://github.com/xebia-france/libtorrent-ios-resources Option A: Pre-configured Xcode Project - https://github.com/chublix/libtorrent-ios - Adapt for OpenSSL Option B: Qt Creator - Build OpenSSL and Boost separately - Build libtorrent, for all the platforms (e.g. iphoneos and iphonesimulator) - lipo (i.e., merge the slices) of the different platforms Option C: Bash Script - cf. xebia-france/libtorrent-ios-resources/build-script
  • 30. Sources Popcorn Time iOS https://github.com/danylokostyshyn/popcorntime-ios Popcorn Time TV: https://github.com/PopcornTimeTV/PopcornTimeTV Popcorn Torrent: https://github.com/PopcornTimeTV/PopcornTorrent (GCD WebServer / Torrent client for iOS)
  • 32. Configuration session_settings settings = ses.settings(); settings.ssl_listen = 4443; settings.active_loaded_limit = 1; settings.max_peerlist_size = 10; settings.min_announce_interval = 30; settings.urlseed_wait_retry = 10; ses.set_settings(settings); // http://libtorrent.org/reference-Settings.html
  • 33. settings.local_service_announce_interval = 30; settings.active_lsd_limit = 1; // ... ses.start_lsd(); // ... ses.stop_lsd(); Configuration (Local Service Discovery)
  • 35. How Incremental Download Works No modification in the content: No Download Modification in the content referenced changed: Download Starts The SHA1 of each chunk is compared to the version on disk:
  • 37. C++ / Swift Bridging 03 04 01 02 Add wrapper class’s header file into bridging header Implement a wrapper class in .mm file (Obj C++ ) Use wrapper class in Swift03
  • 38. C++ / Swift Bridging 02 Implement a wrapper class Wrapper Class (Header) #import <Foundation/Foundation.h> @interface LibTorrentWrapper : NSObject { - (void)initSession:(NSInteger)fromPort toPort:(NSInteger)toPort; - (void)addNewTorrentFromFile:(NSString *)filePath; }
  • 39. C++ / Swift Bridging 02 Implement a wrapper class Wrapper Class (Implementation) @interface LibtorrentWrapper() @property libtorrent::session *session; @end @implementation LibtorrentWrapper - (void)initSession:(NSInteger)fromPort toPort:(NSInteger)toPort { self.session = new libtorrent::session(); session_settings settings = self.session->settings(); // Apply Settings here... self.session->set_settings(settings); libtorrent::error_code ec; self.session->listen_on(std::make_pair(fromPort, toPort), ec) }
  • 40. C++ / Swift Bridging 02 Implement a wrapper class Wrapper Class (Implementation) //... - (void)addNewTorrentWithData:(NSData *)data { libtorrent::add_torrent_params params; params.save_path = // Some dir... libtorrent::error_code ec; params.ti = new libtorrent::torrent_info((const char*)data.bytes, data.length, ec); self.session->add_torrent(params, ec); } @end
  • 41. C++ / Swift Bridging 02 Implement a wrapper class Invoke Wrapper Class in Swift func startTorrentSession() { var torrentWrapper = LibtorrentWrapper() torrentWrapper.initSession(6881, toPort: 6889) torrentWrapper.addNewTorrentWithData(/* Some Data */) }
  • 42. Event loop 03 04 01 02 Pop alert events each time callback is invoked Set-up a timer that triggers a callback periodically Feed torrent progress info03
  • 43. Fetch alerts - (void)fetchAlerts { std::deque<alert *> deque; _session->pop_alerts(&deque); for (std::deque<alert *>::iterator it=deque.begin(); it != deque.end(); ++it) { std::unique_ptr<alert> alert(*it); switch (alert->type()) { case metadata_received_alert::alert_type: //** case piece_finished_alert::alert_type: //** You can feed progress info here case torrent_finished_alert::alert_type: //** default: break; } } deque.clear(); }
  • 44. Fetch torrent progress info - (dl_info)getCurrentTorrentInfo:(piece_finished_alert *)alert { dl_info result; torrent_handle t = alert->handle; try { t->get_torrent_info(); } catch (libtorrent_exception &e) { return result; } torrent_status ts = t->status(torrent_handle::query_pieces); result.seeders = ts.num_seeds; result.peers = ts.num_peers; result.downloadRateBs = ts.download_rate; result.uploadRateBs = ts.upload_rate; torrent_info ti = t->get_torrent_info(); result.downloaded = ts.total_done; result.progress = ts.progress_ppm; result.completed_time = ts.completed_time; return result }
  • 46. Caveats 1 Needs fine tuning, i.e. for avoiding heavy battery consumption No background sessions Almost no iOS help resource available System proxy support to be manually implemented (via CFNetworkCopySystemProxySettings) 2 3 4