Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6705733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:26:17+00:00 2026-05-26T07:26:17+00:00

There are several articles on the internet about how to make udp reliable. I

  • 0

There are several articles on the internet about how to make udp reliable. I have not been able to find one on c#. So maybe I can implement my algorithm.

from researching on the internet I believe udp has two problems:


  1. it does not ensure that all data reaches it’s destination.
  2. data may reach it’s destination on a different order
  3. maybe there is a third problem that I am missing in order to make it reliable

if you are interested in knowing why I want to make udp reliable and why I don’t use tcp instead take a look at this question. Believe me, I been trying to do tcp punch holing for so long.

anyways maybe there is already a library that I can use with c# that will enable me to do this. Because I have note been able to find a library I been thinking about the following algorithm:


“Imagine there is computer A and computer B and computer A is the one that is sending the file to computer B”;

here are the steps that I been thinking of:


1) computer A opens the file for reading and let’s say it is 5000 bytes. that means that computer A will have to send 5000 bytes to computer B making sure no bytes are lost and also in the right order.


2) computer A get’s the first 500 bytes of the file and it get’s the hash of those bytes. so now computer A has two things the hash of those 500 bytes and also the bytes. (the hash will be an efficient algorithm such as md5 to make sure data got received in the right order. that is md5(1,2,3) != md5(2,1,3))


3) imaging the hash of those first 500 bytes comes out to be kj82lkdi930fi1.


4) computer B should be listening for a hash and bytes.


5) computer A sends the hash to computer B. and it sends the 500 bytes too. as soon as it sends that it start’s waiting for a reply.


6) computer B should now receive the hash and the bytes. computer b performs the same algorithm md5 on the received bytes. if that result is equal to the hash that was received then it replies back to A with {1,1,1,1,1,1} otherwise it replies with {2,2,2,2,2,2,2}


6.5) let’s assume computer B got the data on the right order so it replies {1,1,1,1,1,} it also saves the hash code on memory or array.


7) computer A should be waiting for a response in order to send the next 500 bytes. let’s say that it receives {1,1,1}. because it received a 1 it knows it can proceed and send the next 500 bytes with a new hash code of those 500 bytes.


8) computer A sends the next 500 bytes with its hash code.


9) let’s pretend computer B did not receive the data so it does not reply back to A. computer B will still wait for bytes and a hash


8) since computer A has not receive a 1,1,1,1,1, or 2,2,2,2,2, for a reasonable amount of time, then A will send the same bytes and hash again for a second time.


9) let’s assume computer B receives the hash and the bytes but the bytes got received on a different order. when computer B calculates the hash on those bytes then that hash will not match the hash that was received. as a result it will reply back with {2,2,2,2,2,2}


10) if computer A receives the 2,2,2,2,2,2 then it will send the same bytes and hash. if it did not receive the 2,2,2,2,2 for some reason then it will send the same bytes and hash after some period of time. let’s pretend computer A receives 2,2,2,2,2


11) computer A sends the same bytes and hash for the 3th time.


12) computer B receives the hash and bytes on the right order. as a result it replies 1,1,1,1,1,1 and saves that previous hash on memory. (recall step 6.5)


13) lets pretend computer A did not receive the 1,1,1,1 response from B. It will then send the same bytes for the forth time.


14) computer B checks the hashes and if it is equal to the last one that was accepted then it replies 1,1,1,1 again without writing those bytes to the file.


15) the algorithm continues like so until the file get’s transferred.


.

.

.

I mean there are obviously some other things that I need to add to this algorithm such as letting computer B know when the transfer is done. maybe checking for more errors. what happens if computer A get disconnected for a long time. But the main protocol will be something like the one I described.

So do you think I should start implementing this algorithm? should I increase and send more bytes every time. I mean send 1000 instead of 500? There are lots of articles on the internet that tell you about several techniques but very few of them give you a working example on the language that you want. In this case I need this in c#.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:26:18+00:00Added an answer on May 26, 2026 at 7:26 am

    The third problem is that data can be corrupted when you receive it.

    You can start by reading TCP RFC just to understand how TCP makes communication reliable.
    Having that knowledge you can implement some of its techniques using UDP as transport.

    Also take a look at this UDP network library http://code.google.com/p/lidgren-network-gen3/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are several threads on this here at SO but I didn't find one
There are several other questions about this topic that I have gone through, but
There are several variant questions on this on SO, but I did not find
There are several places on the internet that talk about having multy key dictionary
Several articles and blogs I have read suggest placing assemblies I wish to make
While there are several articles written about new classes versus old classed I wasn't
I have lately read several articles and questions about Model Binding and Validation in
I have several articles on a Joomla (1.5) site. These articles are public --
I have found several articles on the Web regarding drawing a dashed line in
I've read several articles about how to use Attached Properties to bind to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.