-3

I just read in my CS book :

  1. At the source computer, the message or the file/document to be sent to another computer is firstly divided into very small parts called Packets.

  2. Each packet is given a number serialwise e.g., 1,2,3...

  3. All these packets are then sent to the address of the destination computer.

  4. The destination computer receives the packets in random manner ( It may even receive packet 10 before packet 1 arrives). If a packet is garbled or lost, it is demanded again.

If this is the case (especially 4th one) then how can I play a song while it's being downloaded. According to 4th statement if packets come in random order then the song/movie shouldn't start before it's completely downloaded.

anurag
  • 11
  • 4
  • packets are sent in order. most of the time they arrive mostly in order. – njzk2 Mar 22 '18 at 03:20
  • If they don't, the receiver just need to rearrange them, if it's too bad, you just need to wait and complain about slow Internet. – user202729 Mar 22 '18 at 03:23
  • Packets generally arrive in the order they are sent, but there is no guarantee that they will arrive in order. If they arrive out of order, it's up to the receiver how it wants to handle that situation. This question might be of interest: https://stackoverflow.com/questions/11747016/what-is-happening-when-a-tcp-sequence-number-arrives-that-is-not-what-is-expecte?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – Jeremy Friesner Mar 22 '18 at 03:58

1 Answers1

-1

Il explain you what happen with the video, but for audio streaming it's almost the same. The audio has only a lower bit rate.

The client use the buffer to mitigate the effect of end-to-end delay. The client tries to download the video's packets faster than it will process them and it saves them in the buffer. This operation is called prefetching. Doing prefetching allows client to process and show the video even if some packets will arrive after others.

At the start of the video you have to wait that some pockets arrives in your buffer. When client's buffer have enought of them it let you see the video. For example on YouTube you see a little circle until your buffer is full enouth.

For example you start a video on YouTube of 35MB, the client calculate a 500Kbit buffer and will wait until 2Kbit. It means that you have to wait until client has downloaded 2Kbit of video. If your connection go down client will continue to use packets stored in the buffer until it will be empty. At that point you have to wait that the clients download again 2Kbit of pockets. If your connection is too fast and the buffer became full it stops to ask packets until buffer has some space again.

Notice that when you pause a streaming video your client still downloads.

Cubesloth
  • 26
  • 2