Monday, February 10, 2014

UDP and TCP: Comparison of Transport Protocols

Posted By: Achchuthan Yogarajah - 2/10/2014 06:35:00 AM

Share

& Comment

You have most likely heard of sockets, and are probably aware that there are two main types: TCP and UDP. When writing a network game, we first need to choose what type of socket to use. Do we use TCP sockets, UDP sockets or a mixture of both?


TCP ( Transmission Control Protocol )

  • Connection based 
  • Guaranteed reliable and ordered 
  • Automatically breaks up your data into packets for you
  •  Makes sure it doesn't send data too fast for the internet connection to handle (flow control)
  •  Easy to use, you just read and write data like its a file

UDP ( User Datagram Protocol )

  • No concept of connection, you have to code this yourself
  •  No guarantee of reliability or ordering of packets, they may arrive out of order, be duplicated, or not arrive at all! 
  • You have to manually break your data up into packets and send them 
  • You have to make sure you don’t send data too fast for your internet connection to handle
  •  If a packet is lost, you need to devise some way to detect this, and resend that data if necessary

About Achchuthan Yogarajah

I’m passionate about Web Development and Programming and I go to extreme efforts to meet my passion. I’m a believer of learning the fundamentals first. I try to understand everything little bit more than the average.

0 comments :

Post a Comment

Copyright © 2016 Believe in Yourself - Achchuthan Yogarajah ACHCHUTHAN.ORG. Designed by Templateism .