• Stars
    star
    1,074
  • Rank 43,067 (Top 0.9 %)
  • Language
    C++
  • License
    MIT License
  • Created over 14 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

uTorrent Transport Protocol library

libutp - The uTorrent Transport Protocol library.

Copyright (c) 2010 BitTorrent, Inc.

uTP is a TCP-like implementation of LEDBAT documented as a BitTorrent extension in BEP-29. uTP provides reliable, ordered delivery while maintaining minimum extra delay. It is implemented on top of UDP to be cross-platform and functional today. As a result, uTP is the primary transport for uTorrent peer-to-peer connections.

uTP is written in C++, but the external interface is strictly C (ANSI C89).

The Interface

The uTP socket interface is a bit different from the Berkeley socket API to avoid the need for our own select() implementation, and to make it easier to write event-based code with minimal buffering.

When you create a uTP socket, you register a set of callbacks. Most notably, the on_read callback is a reactive callback which occurs when bytes arrive off the network. The write side of the socket is proactive, and you call UTP_Write to indicate the number of bytes you wish to write. As packets are created, the on_write callback is called for each packet, so you can fill the buffers with data.

The libutp interface is not thread-safe. It was designed for use in a single-threaded asyncronous context, although with proper synchronization it may be used from a multi-threaded environment as well.

See utp.h for more details and other API documentation.

Example

See ucat.c. Build with:

make ucat

Building

uTP has been known to build on Windows with MSVC and on linux and OS X with gcc. On Windows, use the MSVC project files (utp.sln, and friends). On other platforms, building the shared library is as simple as:

make

To build one of the examples, which will statically link in everything it needs from libutp:

cd utp_test && make

Packaging and API

The libutp API is considered unstable, and probably always will be. We encourage you to test with the version of libutp you have, and be mindful when upgrading. For this reason, it is probably also a good idea to bundle libutp with your application.

License

libutp is released under the MIT license.

Related Work

Research and analysis of congestion control mechanisms can be found here.

More Repositories

1

bootstrap-dht

DHT bootstrap server
C++
401
star
2

bittorrent.org

HTML
356
star
3

sqltorrent

C
265
star
4

go-btfs

BTFS - The First Scalable Decentralized Storage System - A Foundational Platform for Decentralized Applications
HTML
231
star
5

btc

Command-line BitTorrent remote control (btc)
Python
153
star
6

scout

Securely locate peers without central servers
C
151
star
7

webui

JavaScript
112
star
8

bencode

Python
75
star
9

libbtdht

C++
38
star
10

Helix

BitTorrent Tracker
C++
32
star
11

okui

An okay OpenGL-based UI framework.
C++
30
star
12

btfs-dashboard

A Client helps users to manage their BTFS nodes
JavaScript
25
star
13

scraps

Useful scraps of C++.
C++
21
star
14

BTIPs

The BTFS Improvement Proposal repository
18
star
15

sync_api_sample

Python
11
star
16

ut-signing-tool

C++
10
star
17

libbtutils

C++
10
star
18

sync_slack

BitTorrent Sync sample integration with Slack
Python
8
star
19

utorrent_help

Utorrent and bittorrent help files
CSS
7
star
20

simon

A tool to judge your code
Python
7
star
21

sitrep

Public-facing status reports for your infrastructure.
Python
7
star
22

librtmp

Ticket #5945
C
6
star
23

tornado-sqs

Python
6
star
24

social

Home of the social media library for Bittorrent Apps
JavaScript
5
star
25

widgets

The Bittorrent Widgets package is a collection of widgets that integrate with the Apps for BitTorrent SDK, and simplify common behaviors.
JavaScript
4
star
26

org.bittorrent.scribble

Clojure library for generating Graphite graph URLs
Clojure
4
star
27

boost_1_44_0

C++
3
star
28

live-build-environments

Build environments for our stuff
Shell
3
star
29

btfs-airdrop

Solidity
3
star
30

generator-btapp

yeoman webapp generator fork for a btapp sites
JavaScript
3
star
31

ipboard_proxy

Ruby
2
star
32

btfs-encryption

Go
2
star
33

jshackle

Helper macros for JNI programming
C++
2
star
34

docker-kubectl

Docker container for kubectl
1
star
35

live-ci-tools

A [small] collection of CI tools
Python
1
star
36

SDL

Fork of SDL with some minor tweaks
C
1
star
37

go-btfs-cmds

Go
1
star
38

cookbook-bt-foo

Ruby
1
star
39

libtommath-test

C
1
star
40

bigcouch-bin

bigcouch binary repo
Python
1
star
41

mongoose-context-protected-plugin

JavaScript
1
star
42

btfs-vault

Cheque protocol of BTFS node
JavaScript
1
star