GithubHelp home page GithubHelp logo

kryndex / libutp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bittorrent/libutp

0.0 2.0 0.0 260 KB

uTorrent Transport Protocol library

Home Page: http://github.com/bittorrent/libutp

License: MIT License

Makefile 0.69% C++ 78.36% Python 4.00% C 16.95%

libutp's Introduction

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 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.

libutp's People

Contributors

ghazel avatar aqk avatar rmcdonald avatar jech avatar mct avatar ssiloti avatar b-c avatar xercesblue avatar mafintosh avatar anacrolix avatar mikedld avatar ssuominengentoo avatar yumkam avatar arvidn avatar huahang avatar ckerr avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.