In a job interview i had faced a question that

In my company we always use udp because it is very much fast. and we have reliability also. can u answer how? without adding so much overhead to the udp how can you make udp reliable?

  • 5
    You can make UDP reliable by using TCP.
    – RedShift
    Feb 20 '15 at 20:40
  • 1
    Your 1st question end was lost in transmission. Please use a better protocol.
    – dan
    Mar 1 '15 at 15:38
  • Tempted to close this as off topic based on past history. Interview questions don't generally make good questions for this site.
    – YLearn
    Jul 3 '18 at 18:34

UDP by itself isn't reliable. The data acknowledge/retransmission functions have to occur at a higher (i.e. application) level. TFTP is a good example of that.


While UDP is not reliable, a lot of protocols use it as a base and add reliability at application level.

You would determine what features you would need, and what you would implement:

  • Connection handling (keep track of a connection)
  • Sequencing (to rely on order of frames)
  • Acknowledgement (to make sure all frames are received)
  • Flow control (throttle the flow of data)

Sometimes you will only need a few traits and not all. Although if you use all features, refrain of building it yourself: TCP will cramp this all in only a few extra header bytes and some handshaking packets ;)


One way could be to use Reliable UDP(RUDP or RDP). The idea is, the sender sends all packets as normal UDP packets and the receiver indexes all the packets. Once all the packets are transmitted, the receiver sends a lists of packet indexes that it did not receive. This can make UDP reliable.

Although this method will work, it challenges the core idea of UDP, i.e some data loss is acceptable. Like for example, while watching a movie (on a streaming service which uses UDP at transport level) we wouldn’t want the lost packets back after we’ve already watched the movie.

But it may be useful in other areas.

  • What if the list of lost packets indices gets lost? Jul 14 '19 at 7:53
  • The indices go inside the packet and usually are in order. If you got packet 1 and then 3, you know packet 2 was not received. So you re-request that packets. Which is pretty much what tcp/ip does behind your back, besides other things.
    – rxantos
    Jul 15 '19 at 4:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.