FORWARD ERROR CORRECTION


Introduction

          QUANTAnet_fecServer_c and QUANTAnet_fecClient_c are two classes which can be used to stream realtime data over networks. This two classes transmit data by using QUANTAnet_udp_c, and at the same time generate redundancy by using FEC. They do the best-effort to recover the data if lost. They will also try to make sure the right order of data packets.

QUANTA classes used

    QUANTAnet_fecServer_c
    QUANTAnet_fecClient_c

                The use of these two classes is simple.
On the Server Site:
Step1: Instantiate a QUANTAnet_fecServer_c object.
Step2: Setup the required parameters by using
void init(unsigned int numSourcePack, unsigned int numTotalPack, unsigned int payloadSize, unsigned short numRowofRecvBuff, unsigned short timeOut, unsigned short srcPort, unsigned short fecPort)

numSourcePack: number of source packets in the block
numTotalPack: number of packets (including source packets and FEC packets) in the block
payloadSize: size of payload
numRowofRecvBuff: number of rows of receiving buffer
timeout: timeout value (s)
srcPort: source port number
fecPort: FEC port number

For an example:
init(3,4,1024,5,50,7000,7001) means:
One redundant data packet will be generated from every 3 original source data packets. The packet size is 1024 Bytes.
Please note: for every data packet to be sent, the size MUST be 1024. So it's a requirement for users that the data must be done with size of 1024B before sending.
The row size of the receiving buffer array is 5.
7000 UDP port will be used as transmitting original data packets.
7001 UDP port will be used for FEC redundant data packets.

Step3: Receiving data by calling
void streamingRecv(void(* exportFunc)(void*, int))
You have to specify the callbank function exportFunc to let FEC library to export the received data to the application.

On the client site:
Step1: Instantiate a QUANTAnet_fecClient_c object.
Step2: Setup those required parameters by using
void init(unsigned int numSourcePack, unsigned int numTotalPack, unsigned int payloadSize, unsigned short numRowofRecvBuff, char* host, unsigned short srcPort, unsigned short fecPort)

numSourcePack: number of source packets in the block. Same as server's.
numTotalPack: number of packets (including source packets and FEC packets) in the block. Same as server's.
payloadSize: size of payload. Same as server's.
host: hostname of server
srcPort: source port number which must be the same as the one set on the server
fecPort: FEC port number which also is the same as the one set on the server

For an example:
According to the server example above, there will be
init(3,4,1024,"server's name",7000,7001)

Step3: Sending data by calling
void streamingSend(void(*updateFunc)(void*, int))
You need to specify the callback function updateFunc to let application to fill in the date to send by FEC module.


Usage

 1. To start the server, type
       server <srcport> <fecport> <srcnum> <totalnum> <rowsofbuffer> <packetsize>

 2. To start the client, type
       streamclient <server> <srcport> <fecport> <srcnum> <totalnum> <sendrate> <packetsize>

  The streaming client just fills in the whole data block using the sequence number of the block. When the server receives the block succesfully, it will print out the sequence number.For example, if you want to stream data from catmull.evl.uic.edu to laurel.evl.uic.edu, type

  server 39000 39001 3 4 10 1400

on laurel (In this example, laurel is the server). Then type

  streamclient laurel.evl.uic.edu 39000 39001 3 4 5 1400

on catmull.evl.uic.edu.

Output

    On the Client side :

     Receiver: laurel.evl.uic.edu
     source data UDP port: 39000
     fec data UDP port: 39001
     The ratio of src to fec: 3:1
     Sending Rate: 67108864
     UDP payload size: 1400
     len: 1408, offsite: 8, _payloadSize: 1400
     starting steaming data
     starting........
     Interval between blocks is 6720

    On the Server side :

     source data UDP port: 39000
     fec data UDP port: 39001
     The ratio of src to fec: 3:1
     Row of receiving buffer: 10
     UDP payload size: 1400
     log file /tmp/fec_recv.log opened, start receiving...
     1
     2
     .
     .
Once the client stops sending data (i.e., termination of connection between server and client), after a timeout of 10 secs, the server displays the FEC performance charactersitics.
     Total Blocks: 735
     Recovered Blocks: 0
     Failed Blocks: 0
     Failed Packets: 0
     Total Data: 3087000 Bytes
     Loss Rate: 0.000000


for more information: Post your questions online on the Quanta forum page.