Friday 3 February 2017

TCP and UDP Protocol

TCP and UDP

·      Protocols used for sending packets ( bits of data )
·      Packets are forwarded from our computer via routers to a destination

TCP

When we load a webpage: 

  • TCP Packets àre sent to the web server address, Web server responds with a stream of TCP packets stitched together by browser to render the web page.
  • TCP isn’t just one way communication. The remote system sends packets back to acknowledge it’s received your packets.
  • TCP guarantees the recipient will receive the packets in order by numbering them. The recipient sends messages back to the sender saying it received the messages. If the sender doesn’t get a correct response, it will resend the packets to ensure the recipient received them. Packets are also checked for errors
  • TCP is all about this reliability . The packets sent with TCP are tracked so no data is lost or corrupted in transit. This is why file downloads don’t become corrupted even if there are network hiccups

UDP

  • UDP stands for User Datagram Protocol — a datagram is the same thing as a packet of information.
  • When using UDP, packets are just sent to the recipient. The sender won’t wait to make sure the recipient received the packet 
  • UDP is used when speed is desirable and error correction isn’t necessary.

EXAMPLE: Live streaming videos or online video games

For example, let’s say you’re watching a live video stream. Live streams are often broadcast using UDP instead of TCP. The server just sends a constant stream of UDP packets to computers watching. If you lose your connection for a few seconds, the video will freeze for a moment and then jump to the current bit of the broadcast, skipping the bits you missed. If you experience minor packet-loss, the video or audio may be distorted for a moment as the video continues to play without the missing data.

No comments:

Post a Comment