Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i know that UDP does not care about segment (packet) order and their arrival on the destination. then how on earth are we able to stream videos?

  • if a segment is lost (doesn't reach the destination), destination has no idea about it. so, it can't ask the target to retransmit it.
  • if a segment arrives out of the order, should't the video being streamed be distorted? since the whole segment order is wrong now, because of that one segment is not on its place.
share|improve this question

People typically layer another protocol on top of UDP that deals with ordering and reliability, and then insert the video or whatever into that.

share|improve this answer

For lost segments, CODECs are used that degrade the quality of the picture rather than completely giving up. For out of order segments, you add a sequence number to the frames using something like RTP in addition to UDP. There might not be much you can do about receiving out of order, but at least you can detect it. RTP also prevents transmitting faster than the link can support.

For non real time video streaming, like Netflix, Hulu, Youtube, etc. they just use TCP and do buffering instead of UDP, since they don't care about a few seconds delay between the server and client.

share|improve this answer

Keep in mind that while UDP doesn't guarantee packet delivery, network equipment doesn't intentionally drop packets just to punish application users who chose to use UDP over a reliable TCP connection. So part of the answer is that while UDP itself is not reliable, almost all packets still make it across and in intranet environment, where one company controls all traffic and equipment UDP is virtually as reliable as TCP.

That said, one of the most popular video streaming protocols that is based on UDP/IP is RTP. RTP is defined to be application layer protocol but the specification does dictate that it is up to the receiver to monitor packet sequence numbers (part of RTP header) and make sure that the data is played out in correct sequence.

That said, there are plenty of implementations which ignore this little bit of information and they still display video with relatively good quality. Yeah, there are some glitches here and there but for the most part you can't tell as this stuff doesn't happen as frequently as some networking books would lead you to believe. At least that's my experience, but I've been working mostly on video products in corporate environments, not the Internet. I'll see if I have a different answer for you in about 6-12 months as we are moving more towards mobile/internet options.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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