GithubHelp home page GithubHelp logo

lt_codes's Introduction

LT Codes

Erasure codes are a class of codes that allow information to be transferred over lossy channels where missing information can be inferred from additional data packets. This project implements one class of erasure codes known as LT Codes that were introduced by Michael Luby. For more information have a look at the corresponding Wikipedia page.

The LT codes belong also to the class of Fountain Codes, which describe erasure codes that are rateless in the sense that possibly infinitely many packets can be generated from a source file. The name Fountain Codes stems from the concept of a real water fountain that never stops spitting water.

Examples

We built two sample applications, one encodes and decodes a single file locally, whereas the other uses a UDP broadcast to send a file across a network.

Local Example

In this example the application reads a file, splits it up in a couple of packets, encodes them, sends them to the client which then tries to decode them. The server sends a predefined amount of packets to the client and depending on the parameterization the client may or may not be able to decode the original file. To make this example a bit more realistic we set up a virtual erasure channel whose loss rate can be defined as parameter.

The main class that is used to execute the application is lt_codes.local.InMemoryFileTransfer and it takes mainly three parameters:

  • filename: the name of the file that should be processed
  • erasure_probability: the probability that a packet is lost, e.g. 0.1 means that approximately 10% of the packets are lost during transmission
  • packet_overhead: the number of packets to transmit, 1.4 means 40% more packets than the file actually has

With the following command the application can be executed:

java \
  -cp lib/*:lt_codes-1.0-SNAPSHOT.jar \
  lt_codes.local.InMemoryFileTransfer \
  --verbose --erasure_probability 0.1 --packet_overhead 1.40 <FILENAME>

UDP Broadcast Example

Whereas the previous application transferred a file only within the program, this application transfers a file from one sender to many receivers on the same local subnet. For this to work the application uses the IP protocol's broadcast feature, the sender transmits a packet to a designated broadcast IP address and the local router forwards it automatically to all hosts. All the receiver has to do is open a socket on a predefined port and wait for the broadcasted packets to arrive.

For a list of designated IP broadcast address have a look on this page: http://en.wikipedia.org/wiki/Multicast_address

As already mentioned this applications consists of two actors, the sender and the receiver. Both of them take the same set of parameters:

  • filename: the name of the file that should be processed
  • address: the designated IP broadcast address
  • port: the port used to open a socket

The sender is implemented as a fountain, meaning that it never stops generating and transmitting new packets unless it is manually killed by the user. To start the sender on port 4445 and broadcasting to the IP address 224.0.0.1 use the following command:

java \
  -cp lib/*:lt_codes-1.0-SNAPSHOT.jar \
  lt_codes.broadcast.BroadcastSender \
  --verbose --address 224.0.0.1 --port 4445 <FILENAME>

Similarly, the receiver can be started with the same set of parameters as follows. Note that the receiver needs also to know the filename, because this information is not transmitted in the header of the packets. If you start the sender and receiver in the same directory use a different (possibly non-existent) filename, otherwise the file is locked by the sender.

java \
  -cp lib/*:lt_codes-1.0-SNAPSHOT.jar \
  lt_codes.broadcast.BroadcastReceiver \
  --verbose --address 224.0.0.1 --port 4445 <FILENAME>

lt_codes's People

Contributors

k13n avatar

Watchers

 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.