quiet / libcorrect

C library for Convolutional codes and Reed-Solomon
BSD 3-Clause "New" or "Revised" License
378 stars 95 forks source link

network simulation help for reed solomon codes #11

Closed peererror closed 6 years ago

peererror commented 7 years ago

Hi I wanted to recover packet lost on udp using the library is it possible if? yes than how I can I that .Any function or steps will also be help full
Thanks for the hard work .

brian-armstrong commented 7 years ago

I think this might be relevant to your question https://stackoverflow.com/questions/28924342/error-correcting-codes-for-packet-loss-udp

brian-armstrong commented 7 years ago

Just to follow up here, libcorrect could be useful to you, but you'll need to do a little extra work. The only relevant part of libcorrect would be its Reed-Solomon encoder/decoder. libcorrect's R-S system works on groups of 255 bytes. A common scheme is R-S 223,255 where you split your message into groups of 255 bytes and can recover your original message if it loses up to 32 bytes as long as you know which bytes are lost (also known as erasures).

Because you're doing UDP, and those packets will be all or nothing, you'll need to do your own interleaving of bytes from neighboring packets so that the loss of one packet doesn't lose the entire 255-byte group. One obvious approach here would be to take a message that's some multiple k of 255 bytes long and interleave it into 255, k-byte long packets, such that each byte is part of a different R-S group. It'd be then up to you to decide which packets are lost (sequence numbers?) and de-interleave and apply erasure fixing via R-S decoder.

It's possible other libraries exist already to handle interleaving. Good luck whichever way you choose.

peererror commented 7 years ago

Thanks for helping me . I will keep your suggestions in my mind . Thanks for the hard work