THE SCHOOL OF CISCO NETWORKING (SCN): TCP VERSUS UDP:
Contact No:   ### / ###/ ###
Welcome To The IT Knowledge Base Sharing Freeway "Study With The Zero Fees / Zero Money" Web - If We Believe, That If We Have Knowledge, Let Others Light Their Candles With It. - Our Motivation Has Brought Us Together To Offer Our Helping Hands To The Needy Ones Please. "Student Expectations And Satisfaction Is Always Our Highest Priority")

'Love All, Serve All, Help Ever Hurt Never'

Please Welcome To The "Zero Fees And Zero Money SCN Community Study Page"

We Like To Share Our Stuff With Everyone And Hope You Will Find Something Useful Here. Enjoy Our Collection And Come Back Again And Again, We'll Do Our Best To Make It Always Interesting For You. All Our Stuff Always Available May Be 100% Totally Freely. Use Only For Non-Commercial Purposes Only!

THE SCHOOL OF CISCO NETWORKING (SCN) Is A IT Support Community – Based, Non - Profit Volunteer Organizations, Offering Our Assistance And Support To Developmental Our Services Dedicated To All.

Because Large Section Of Our Students In This World, Especially In Villages, Who Are Under Privileged Expecting For Equal Opportunity In Terms Of Money And Education. We Feel The Sufferings Of Talented Students Losing Their Opportunity To Shine Because Of Their Poor Financial Status. So We Thought That Professional Education Will Be Providing Them Freely.

Our Web Site Is To Give An Easy Way To Understand Each And Every Student Who Are Going To Start CISCO Lab Practice Without Any Doubts And Our ARTICLES STUFF Are Always 100% Totally Free For Everyone, Which Is Belongings To THE SCHOOL OF CISCO NETWORKING (SCN).

Also This Guide Provides Technical Guidance Intended To Help All Network Students, Network Administrators And Security Officers Improve Of Their Demonstrated Ability To Achieve Specific objectives Within Set Timeframes.

Hands - On Experience Is An Invaluable Part Of Preparing For The Lab Exam And Never Pass Up An Opportunity To Configure Or Troubleshoot A Router ( If You Have Access To Lab Facilities, Take Full Advantage Of Them) There Is No Replacement For The Experience You Can Gain From Working In A Lab, Where You Can Configure Whatever You Want To Configure And Introduce Whatever Problems You Want To Introduce, Without Risk Of Disrupting A Production Network.

For Better View Of Our Web Page - Please Use Any Latest Web Browser, Such As (Mozilla Firefox, Google Chrome, Opera, Safari, Internet Explorer, Torch, Maxthon, Sea Monkey, Avant Browser, Deepnet Explorer, And Etc ), Because Some Elements Or Scripts Are Not Work In The Old Web Browser (It Might Not Be Displayed Properly Or Are Not Appearing properly!). Thank You For Your Time And Best Of Luck!

Your Sincerely – Premakumar Thevathasan.
"Our Motivation Has Brought Us Together To Offer Our Helping Hands To The Needy Once Please,Thank You."

TCP VERSUS UDP:

FIRST UNDERSTAND OSI LAYERS :





OSI - TRANSPORT LAYER



BEFORE GO TO TCP FIRST UNDERSTAND THE TRANSPORT LAYER :


The Transport Layer Includes Two Major Protocols Transmission Control Protocol (Tcp) And User Datagram Protocol (UDP). TCP And UDP At The Transport Layer Help In Data Communication As Explained Below:

1) An Interface For Network Applications To Access The Network.

2) Provides Means Accepting Data From Different Applications And Directing That Data To The Recipient Application On The Receiving Device (Multiplexing). Same Way, On The Receiving Device The Data Need To Be Directed To The Correct Application, For That Data Was Meant For (De-Multiplexing).

3) Error Checking, Flow Control, And Verification. Two Major Protocols At The Transport Layer, Transmission Control Protocol (TCP) And User Datagram Protocol (UDP), Work Differently To Achieve These Goals.

Transmission Control Protocol (TCP): TCP Is A Reliable Protocol. TCP Provides Extensive Error Control And Flow Control To Ensure The Successful Delivery Of Data. TCP Is Called As A Connection-Oriented Protocol.

User Datagram Protocol (UDP): UDP Is Not Much Reliable Protocol. There Is No Error Checking Features For UDP And Is Designed For Situations When Extensive Control Features Are Not Necessary. UDP Is Called As A Connectionless Protocol.

THE MAJOR PROTOCOLS AT TRANSPORT LAYER ARE:

  • 1. Transmission Control Protocol (TCP).

  • 2. And User Datagram Protocol (UDP).

    TCP Is Connection Oriented – Once A Connection Is Established, Data Can Be Sent Bidirectional.

    UDP Is A Simpler, Connectionless Internet Protocol. Multiple Messages Are Sent As Packets In Chunks Using UDP.



    TRANSMISSION CONTROL PROTOCOL (TCP)



    TRANSMISSION CONTROL PROTOCOL (TCP):

    TCP Is A Reliable Transport Mechanism So It Will Be Used Where The Packet Delivery Is A Must Even In Congestions.

    TCP Stands For Transmission Control Protocol. It Is Described In STD-7/RFC-793. TCP Is A Connection-Oriented Protocol That Is Responsible For Reliable Communication Between Two End Processes. The Unit Of Data Transferred Is Called A Stream, Which Is Simply A Sequence Of Bytes.

    The Transmission Control Protocol (TCP) Is One Of The Core Protocols Of The Internet Protocol Suite. TCP Is One Of The Two Original Components Of The Suite, Complementing The Internet Protocol (IP), And Therefore The Entire Suite Is Commonly Referred To As TCP/IP.

    TCP Provides Reliable, Ordered Delivery Of A Stream Of Bytes From A Program On One Computer To Another Program On Another Computer.

    Regarding The Data Transport, We Need To Be Aware, That TCP Works On Data Streams, And Not On Data Blocks. The Secure TCP Frame Transport And The Packet Structure Of The Underlying IP Protocol Is Completely Hidden. The Transport Mechanism Even Will Split And Concatenate Blocks On The Fly, Trying To Create As Big IP Packets As Possible, To Reduce The Overhead, And Using One IP Packet For Each TCP Frame To Facilitate The Correction Of Lost Packets.

    TCP Is One Of The Main Protocols In TCP/IP Networks. Whereas The IP Protocol Deals Only With Packets, TCP Enables Two Hosts To Establish A Connection And Exchange Streams Of Data. TCP Guarantees Delivery Of Data And Also Guarantees That Packets Will Be Delivered In The Same Order In Which They Were Sent.

    CONNECTION-ORIENTED MEANS: That Before Actually Transmitting Data, You Must Open The Connection Between The Two End Points. The Data Can Be Transferred In Full Duplex (Send And Receive On A Single Connection). When The Transfer Is Done, You Have To Close The Connection To Free System Resources. Both Ends Know When The Session Is Opened (Begin) And Is Closed (End). The Data Transfer Cannot Take Place Before Both Ends Have Agreed Upon The Connection. The Connection Can Be Closed By Either Side; The Other Is Notified. Provision Is Made To Close Gracefully Or Just Abort The Connection.

    STREAM ORIENTED MEANS : That The Data Is An Anonymous Sequence Of Bytes. There Is Nothing To Make Data Boundaries Apparent. The Receiver Has No Means Of Knowing How The Data Was Actually Transmitted. The Sender Can Send Many Small Data Chunks And The Receiver Receive Only One Big Chunk, Or The Sender Can Send A Big Chunk, The Receiver Receiving It In A Number Of Smaller Chunks. The Only Thing That Is Guaranteed Is That All Data Sent Will Be Received Without Any Error And In The Correct Order. Should Any Error Occur, It Will Automatically Be Corrected (Retransmitted As Needed) Or The Error Will Be Notified If It Can't Be Corrected.

    TRANSMISSION CONTROL PROTOCOL (TCP) Is Responsible For Breaking Up The Message (Data From Application Layer) Into TCP Segments And Reassembling Them At The Receiving Side. It Is Not Sure That The Data Reaching At The Receiving Device Is In The Same Order As The Sending Side, Because Of The Problems In Network Or Different Paths Packets Flow To The Destination. TCP Is Responsible For Keeping The Unordered Segments In The Right Order. TCP Assures A Reliable Delivery By Resending Anything That Gets Lost While Traveling The Network.

    WHAT ARE THE CHARACTERISTICS OF TCP :


    STREAM DATA TRANSFER: Applications Working At The Application Layer Transfers A Contiguous Stream Of Bytes To The Bottom Layers. It Is The Duty Of TCP To Pack This Byte Stream To Packets, Known As TCP Segments, Which Are Passed To The Ip Layer For Transmission To The Destination Device. The Application Does Not Have To Bother To Chop The Byte Stream Data Packets.

    RELIABILITY : The Most Important Feature Of TCP Is Reliable Data Delivery. In Order To Provide Reliability, TCP Must Recover From Data That Is Damaged, Lost, Duplicated, Or Delivered Out Of Order By The Network Layer. TCP Assigns A Sequence Number To Each Byte Transmitted, And Expects A Positive Acknowledgment (ACK) From The Receiving Tcp Layer. If The ACK Is Not Received Within A Timeout Interval, The Data Is Retransmitted. The Receiving TCP Uses The Sequence Numbers To Rearrange The Segments When They Arrive Out Of Order, And To Eliminate Duplicate Segments.

    FLOW CONTROL : Network Devices Operate At Different Data Rates Because Of Various Factors Like CPU And Available Bandwidth. It May Happen A Sending Device To Send Data At A Much Faster Rate Than The Receiver Can Handle. TCP Uses A Sliding Window Mechanism For Implementing Flow Control. The Number Assigned To A Segment Is Called The Sequence Number And This Numbering Is Actually Done At The Byte Level. The TCP At The Receiving Device, When Sending An Ack Back To The Sender, Also Indicates To The TCP At The Sending Device, The Number Of Bytes It Can Receive (Beyond The Last Received TCP Segment) Without Causing Serious Problems In Its Internal Buffers.

    MULTIPLEXING: Multitasking Achieved Through The Use Of Port Numbers.

    CONNECTIONS: Before Application Processes Can Send Data By Using TCP, The Devices Must Establish A Connection. The Connections Are Made Between The Port Numbers Of The Sender And The Receiver Devices. A TCP Connection Identifies The End Points Involved In The Connection. A Socket Number Is A Combination Of IP Address And Port Number, Which Can Uniquely Identify A Connection.

    FULL DUPLEX: TCP Provides For Concurrent Data Streams in Both Directions

    THREE-WAY HANDSHAKE IN TCP:


    TCP Use Three Way Handshake (3 Way Handshake).

    Before The Sending Device And The Receiving Device Start The Exchange Of Data, Both Devices Need To Be Synchronized. During The TCP Initialization Process, The Sending Device And The Receiving Device Exchange A Few Control Packets For Synchronization Purposes. This Exchange Is Known As A Three-Way Handshake.

    The Three-Way Handshake Begins With The Initiator Sending A TCP Segment With The SYN Control Bit Flag Set.

    TCP Allows One Side To Establish A Connection. The Other Side May Either Accept The Connection Or Refuse It. If We Consider This From Application Layer Point Of View, The Side That Is Establishing The Connection Is The Client And The Side Waiting For A Connection Is The Server.

    TCP IDENTIFIES TWO TYPES OF OPEN CALLS:


    ACTIVE OPEN:In An Active Open Call A Device (Client Process) Using Tcp Takes The Active Role And Initiates The Connection By Sending A TCP SYN Message To Start The Connection.

    PASSIVE OPEN : A Passive Open Can Specify That The Device (Server Process) Is Waiting For An Active Open From A Specific Client. It Does Not Generate Any Tcp Message Segment. The Server Processes Listening For The Clients Are In Passive Open Mode.

    TRANSMISSION CONTROL PROTOCOL (TCP) SEGMENT HEADER AS FOLLOWS :



    SOURCE PORT: 16 Bit Number Which Identifies The Source Port Number (Sending Port).

    Destination Port: 16 Bit Number Which Identifies The Destination Port Number (Receiving Port).

    SEQUENCE NUMBER: 32 Bit Number Used For Byte Level Numbering Of TCP Segments. If You Are Using TCP, Each Byte Of Data Is Assigned A Sequence Number. If SYN Flag Is Set (During The Initial Three Way Handshake Connection Initiation), Then This Is The Initial Sequence Number.

    The Sequence Number Of The Actual First Data Byte Will Then Be This Sequence Number Plus 1. For Example, Let The First Byte Of Data By A Device In A Particular TCP Header Will Have Its Sequence Number In This Field 50000. If This Packet Has 500 Bytes Of Data In It, Then The Next Packet Sent By This Device Will Have The Sequence Number Of 50000 + 500 + 1 = 50501.

    ACKNOWLEDGMENT NUMBER: 32 Bit Number Field Which Indicates The Next Sequence Number That The Sending Device Is Expecting From The Other Device.

    HEADER LENGTH: 4 Bit Field Which Shows The Number Of 32 Bit Words In The Header. Also Known As The Data Offset Field. The Minimum Size Header Is 5 Words (Binary Pattern Is 0101).

    RESERVED : Always Set To 0 (Size 6 Bits).

    CONTROL BIT FLAGS: We Have Seen Before That TCP Is A Connection Oriented Protocol. The Meaning Of Connection Oriented Protocol Is That, Before Any Data Can Be Transmitted, A Reliable Connection Must Be Obtained And Acknowledged. Control Bits Govern The Entire Process Of Connection Establishment, Data Transmissions And Connection Termination.

    The Control Bits Are Listed As Follows: They Are:

    URG: Urgent Pointer.

    ACK: Acknowledgement.

    PSH: This Flag Means Push Function. Using This Flag, TCP Allows A Sending Application To Specify That The Data Must Be Pushed Immediately. When An Application Requests The TCP To Push Data, The TCP Should Send The Data That Has Accumulated Without Waiting To Fill The Segment.

    RST: Reset The Connection. The RST Bit Is Used To RESET The TCP Connection Due To Unrecoverable Errors. When An RST Is Received In A TCP Segment, The Receiver Must Respond By Immediately Terminating The Connection. A RESET Causes Both Sides Immediately To Release The Connection And All Its Resources. As A Result, Transfer Of Data Ceases In Both Directions, Which Can Result In Loss Of Data That Is In Transit. A TCP RST Indicates An Abnormal Terminination Of The Connection.

    SYN: This Flag Means Synchronize Sequence Numbers. Source Is Beginning A New Counting Sequence. In Other Words, The TCP Segment Contains The Sequence Number Of The First Sent Byte (ISN).

    FIN: No More Data From The Sender. Receiving A TCP Segment With The FIN Flag Does Not Mean That Transferring Data In The Opposite Direction Is Not Possible. Because TCP Is A Fully Duplex Connection, The FIN Flag Will Cause The Closing Of Connection Only In One Direction. To Close A TCP Connection Gracefully, Applications Use The FIN Flag.

    WINDOW : Indicates The Size Of The Receive Window, Which Specifies The Number Of Bytes Beyond The Sequence Number In The Acknowledgment Field That The Receiver Is Currently Willing To Receive.

    CHECKSUM: The 16-Bit Checksum Field Is Used For Error-Checking Of The Header And Data.

    URGENT POINTER: Shows The End Of The Urgent Data So That Interrupted Data Streams Can Continue. When The URG Bit Is Set, The Data Is Given Priority Over Other Data Streams (Size 16 Bits).

    The Fields In Transmission Control Protocol (TCP) Segment Header Are Source Port, Destination Port, Sequence Number, Acknowledgement Number, Header Length, Flags, Window Size, TCP Checksum And Urgent Pointer.

    TCP MESSAGE ALSO IN POINTS FORMAT :


    i. Source Port Number (16 Bits)

    ii. Destination Port Number (16 Bits)

    iii. Sequence Number (32 Bits) - The Byte In The Data Stream That The First Byte Of This Packet Represents.

    iv. Acknowledgement Number (32 Bits) - Contains The Next Sequence Number That The Sender Of The Acknowledgement Expects To Receive Which Is The Sequence Number Plus 1 (Plus The Number Of Bytes Received In The Last Message?). This Number Is Used Only If The ACK Flag Is On.

    v. Header Length (4 Bits) - The Length Of The Header In 32 Bit Words, Required Since The Options Field Is Variable In Length.

    vi. Reserved (6 Bits).

    vii. URG (1 Bit) - The Urgent Pointer Is Valid.

    viii. ACK (1 Bit) - Makes The Acknowledgement Number Valid.

    ix. PSH (1 Bit) - High Priority Data For The Application.

    x. RST (1 Bit) - Reset The Connection.

    xi. SYN (1 Bit) - Turned On When A Connection Is Being Established And The Sequence Number Field Will Contain The Initial Sequence Number Chosen By This Host For This Connection.

    xii. FIN (1 Bit) - The Sender Is Done Sending Data.

    xiii. Window Size (16 Bits) - The Maximum Number Of Bytes That The Receiver Will To Accept.

    xiv. TCP Checksum (16 Bits) - Calculated Over The TCP Header, Data, And TCP Pseudo Header.

    xv. Urgent Pointer (16 Bits) - It Is Only Valid If The URG Bit Is Set. The Urgent Mode Is A Way To Transmit Emergency Data To The Other Side Of The Connection. It Must Be Added To The Sequence Number Field Of The Segment To Generate The Sequence Number Of The Last Byte Of Urgent Data.

    xvi. Options (Variable Length.




    USER DATAGRAM PROTOCOL (UDP)



    USER DATAGRAM PROTOCOL (UDP) :


    User Datagram Protocol (UDP) Is A Protocol At Transport Layer, Which Is Not Reliable When Compared With Transmission Control Protocol (TCP).

    User Datagram Protocol (UDP) Is Also Called As A Connection Less Protocol. UDP Is Much Simpler Than TCP, And It Doesn't Perform Any Of The Complex Functions Of TCP We Discuss Before.

    User Datagram Protocol (UDP) Is A Simple Transmission Protocol Provides Unreliable Service. It Does Not Mean That UDP Will Not Deliver The Data But There Are No Mechanisms To Monitor Congestion Control Or Packet Loss Etc. Since Its Simple It Avoids The Overhead Processing At The Network Interface.

    User Datagram Protocol (UDP) Is Basically An Application Interface To IP. UDP Provides No Reliability, Flow-Control, Or Error Recovery To IP. UDP Only Serves As A Multiplexer/Demultiplexer Using Port Numbers.

    WHAT ARE THE CHARACTERISTICS OF UDP :


    1) User Datagram Protocol (UDP) Is A Connectionless Protocol, Which Means UDP Is Not A Reliable Protocol When Compared With Transmission Control Protocol (TCP).

    2) User Datagram Protocol (UDP) Is Capable Of Performing Fundamental Error Checking. The UDP Header Includes A Checksum Field That The Destination Device Can Use To Check The Integrity Of The Data.

    3) User Datagram Protocol (UDP) Does Not Provide Sequencing Of Data. Therefore, The Data May Arrive At The Destination Device In A Different Order From Which It Was Sent. This May Happen In Large Networks, Such As The Internet, Where The Datagrams Might Take Different Paths To The Destination And Experience Delays In Different Routers. In LAN's Sequencing Is Not Going To Create Problems. Applications That Require Sequencing Must Code Their Own Sequencing Mechanism As Part Of The Application.

    HOW TCP AND UDP WORK :


    A TCP Connection Is Established Via A Three Way Handshake, Which Is A Process Of Initiating And Acknowledging A Connection. Once The Connection Is Established Data Transfer Can Begin. After Transmission, The Connection Is Terminated By Closing Of All Established Virtual Circuits.

    UDP Uses A Simple Transmission Model Without Implicit Hand-Shaking Dialogues For Guaranteeing Reliability, Ordering, Or Data Integrity. Thus, UDP Provides An Unreliable Service And Datagrams May Arrive Out Of Order, Appear Duplicated, Or Go Missing Without Notice. UDP Assumes That Error Checking And Correction Is Either Not Necessary Or Performed In The Application, Avoiding The Overhead Of Such Processing At The Network Interface Level. Unlike TCP, UDP Is Compatible With Packet Broadcasts.

    TCP, UDP – ADDRESSING :


    TCP And UDP Use The Same Addressing Scheme. An IP Address (32 Bits Number, Always Written As Four 8-Bit Number Expressed As Unsigned 3-Digit Decimal Numbers Separated By Dots Such As 192.168.25.26) And A Port Number (A 16-Bit Number Expressed As A Unsigned Decimal Number).

  • The IP Address Is Used By The Low-Level Protocol (IP) To Route The Datagram To The Correct Host On The Specified Network.

  • Then The Port Number Is Used To Route The Datagram To The Correct Host Process (A Program On The Host).

    For A Given Protocol (TCP Or UDP), A Single Host Process Can Exist At A Time To Receive Data Sent To The Given Port. Usually One Port Is Dedicated To One Process.

    WHY UDP IS FASTER THAN TCP?


    The Reason UDP Is Faster Than TCP Is Because There Is No Form Of Flow Control. No Error Checking, Error Correction, Or Acknowledgement Is Done By UDP.

    UDP Is Only Concerned With Speed. When The Data Sent Over The Internet Is Affected By Collisions, And Errors Will Be Present.

    UDP Packet's Called As User Datagrams With 8 Bytes Header. In The User Datagrams First 8 Bytes Contains Header Information And The Remaining Bytes Contains Data.

    USER DATAGRAM PROTOCOL (UDP) HEADER :


    UDP Consist Of Header And Body, Just Like IP Datagrams. The Body Part Contains Whatever Data Was Provided By The Application, White The Header Contains The Fields That Tell The Destination UDP Software What To Do With The Data.


    THE UDP STRUCTURE :


    The Total Size Of The Header Will Vary According To The Size Of The Data In The Body Part. The Fields In A UDP Massage Are Shows In The Table Bellow, Along With Their Size (In Bytes) And Their Usage.

    UDP Header Does Not Provide Any Fields For Source Or Destinations IP Addresses, Or For Any Other Service That Are Not Specifically Related To UDP. This Is Because Those Service Are Provided By Lower Layer (IP) Or By Higher Layer (Application).

    HEADER SIZE :


    Theoretically The Minimum Size Of UDP Header Is 8 Byte. Although This Will Not Leave Any Space For Data In The Message. In Reality, No UDP Message Should Ever Be Generated That Does Not Contain At Least Some Data.

    SOURCE PORT :

    Source Port Is An Optional Field. When Used, It Indicates The Port Of The Sending Process And May Be Assumed To Be The Port To Which A Reply Should Be Addressed In The Absence Of Any Other Information. If Not Used, A Value Of Zero Is Inserted.

    16 Bit Port Number In Use By The Application That Is Sending The Data.

    DESTINATION PORT :

    It Is The Port Number On Which The Data Is Being Sent.

    16 Bit Target Port Number Of The Application That Is To Receive This Data

    LENGTH :

    It Include The Length Of UDP Header And Data.

    The Length In Octets Of This User Datagram, Including This Header And The Data. The Minimum Value Of The Length Is Eight.

    Specifies The Size Of The Total UDP Message, Including Both The Header And Data Segments.

    CHECKSUM :

    The Last 16 Bits Of The UDP Header Are Reserved For The Checksum Value. Checksum Is Used As An Error-Detection Mechanism. The Source Machine Runs A Mathematical Algorithm On The Datagram. The Destination, Or Recipient, Machine Runs The Same Mathematical Algorithm On The Datagram. If The Both Values Match We Can Assume That The Datagram Wasn't Damaged While Its Journey.

    The Checksum Field Includes A 12-Byte 'Pseudo Header' That Includes The Source And Destination IP Addresses, The 8-Bit Reserved Field Containing 0, The 8-Bit Protocol ID And The 16-Bit UDP Length Field. The Pseudo Header Is Useful To Check That The IP Datagram Arrived At The Correct Station.

    Important Protocols Which Use UDP As The Transport Layer Protocol Are Trivial File Transfer Protocol (TFTP), Domain Name System (DNS), Remote Procedure Call (RPC) Used By The Network File System (NFS), Simple Network Management Protocol (SNMP) And Lightweight Directory Access Protocol (LDAP).

    DATA :

    It Is The Application Data. Or Actual Message.

    UDP PACKET :





    ADVANTAGES AND DISADVANTAGES



    WHAT ARE THE ADVANTAGES AND DISADVANTAGES OVER THE UDP vs TCP :


    Transmission Control Protocol (TCP) And User Datagram Protocol (UDP) Are Two Protocols That Run On The Forth Layer Of OSI Layers. There Are Many Advantages Of Using TCP Over UDP.

    TCP Gives Guarantee That A Packet Will Reach On The Destination Without Any Duplication And The Order Of Data Will Be Same. But On The Other Hand UDP Does Not Give Guarantee That Data Will Reach On Destination. It Does Not Gives Guarantee That Data Will Be In The Same Order And It Also Does Not Give Guarantee That Data Will Reached On Destination Without Any Duplication.

    The Advantages Of TCP Over UDP Are Quite Clear, As TCP Guarantees That The Sent Data Actually Arrives, That It Arrives In Order And That There Are No Duplicates, While UDP Provides None Of These Guarantees (Only Offers "Best Effort" Policy). Unlike TCP, UDP Does Not Provide Any Flow And Congestion Control.

    On The Surface, An Unreliable Transport Protocol Like UDP May Not Seem Very Worthwhile Or Desirable. But In Fact, UDP Can Be Very Useful In Certain Situations, And It Enjoys One Key Advantage Over TCP - Speed. The Reliability Features Built Into TCP Can Be Expensive In Terms Of Overhead At Execution Time.

    FOLLOWING REASONS MANY APPLICATIONS FIND UDP WELL-SUITED FOR THEIR NEEDS:


    NO CONNECTION ESTABLISHMENT :

    While TCP Uses A Three-Way Handshake Before It Starts To Transfer Data, UDP Just Blasts Away Without Any Formal Preliminaries. Thus, UDP Does Not Introduce Any Delay To Establish A Connection. This Feature Is Most Useful To Applications Which Exchange Sporadic And Low-Volume Data.

    NO CONNECTION STATE :

    TCP Maintains Connection State In The End Systems. This Connection State Includes Receive And Send Buffers, Congestion Control Parameters, And Sequence And Acknowledgment Number Parameters. This State Information Is Needed To Implement TCP's Reliable Data Transfer Service And To Provide Congestion Control. UDP, On The Other Hand, Does Not Maintain Connection State And Does Not Track Any Of These Parameters. For This Reason, A Server Devoted To A Particular Application Can Typically Support Many More Active Clients When The Application Runs Over UDP Rather Than TCP.

    SMALL SEGMENT HEADER OVERHEAD :

    The TCP Segment Has 20 Bytes Of Header Overhead In Every Segment, Whereas UDP Only Has 8 Bytes Of Overhead. TCP Needs More Header Fields In Order To Guarantee Reliability, While UDP, That Gives No Guarantees, Does Not.

    UNREGULATED SEND RATE :

    TCP Has A Congestion Control Mechanism That Throttles The Sender When One Or More Links Between Sender And Receiver Becomes Excessively Congested. This Throttling Can Have A Severe Impact On Real-Time Applications, Which Can Tolerate Some Packet Loss But Require A Minimum Send Rate. On The Other Hand, The Speed At Which UDP Sends Data Is Only Constrained By The Rate At Which The Application Generates Data, The Capabilities Of The Source (CPU, Clock Rate, Etc.) And The Access Bandwidth To The Internet. We Should Keep In Mind, However, That The Receiving Host Does Not Necessarily Receive All The Data. When The Network Is Congested, A Significant Fraction Of The UDP-Transmitted Data Could Be Lost Due To Router Buffer Overflow. Thus, The Receive Rate Is Limited By Network Congestion Even If The Sending Rate Is Not Constrained.

    LOWER LATENCY :

    With TCP, If A Packet Is Lost, But The Next Packet Makes It Through, The Kernel Will Withhold That Packet Until The Earlier Packet Can Be Re-Sent. This Is Because TCP Is A Guaranteed, In-Order, Stream Protocol. This Means That "Fresh" Data Will Sit In The Kernel, Becoming "Stale", While Waiting For The TCP Timeout To Be Retransmitted (A Minimum Of 3 Seconds For A Lost Packet). This Is Why UDP Is Usually Better For Games, Voice Conferencing, And Other Low-Latency Applications.

    BROADCAST AND MULTICAST :

    Being A Connection-Oriented Protocol, TCP Does Not Support Broadcast And Multicast. Therefore, Applications That Require This Kind Of Service Will Have To Use UDP As A Transport Protocol.

    APPLICATION FLEXIBILITY :

    The Fact That UDP Lacks Built-In Reliability Mechanisms Can Be Considered An Advantage From The Application Designer's Point Of View. Building Reliability Directly Into The Application Allows The Application To "Have Its Cake And Eat It Too". That Is, Application Processes Can Communicate Reliably Without Being Constrained By The Transmission Rate Constraints Imposed By TCP's Congestion Control Mechanism. Application-Level Reliability Also Allows An Application To Tailor Its Own Application-Specific Form Of Error Control.

    For Example, An Interactive Real-Time May Occasionally Choose To Retransmit A Lost Message, Provided That Round Trip Network Delays Are Small Enough To Avoid Adding Significant Playout Delays. In Fact, Many Of Today's Proprietary Streaming Applications Do Just This: They Run Over UDP, But They Have Built Acknowledgements And Retransmissions Into The Application In Order Reduce Packet Loss.



    TCP vs UDP



    TCP vs UDP:


    TCP As We Know Is A Connection Based Protocol, Meaning That A Connection Needs To Be Setup Before The Transfer Of Data Can Start. To Be Able To Do That TCP Has Been Designed With The 3-Way Handshake System. In This System A User Who Wants To Send Data Initializes The Connection And Is Acknowledged By The Receiving End. Once Acknowledged, The Sender Acknowledges The Acknowledgement, Thus Completing The 3-Way Handshake. In This Way, TCP Can Establish A Connection.

    TCP Is A Reliable Protocol, Meaning That The Data That Is Sent Is Reached By The Receiving Party, Which Is Not An Entity In UDP. Data Packets That Are Lost Are Resent Again, If The Connection Fails Then The Data Is Re-Requested, Thus Making Sure That Data Is Received At The Other End.

    TCP Enables Data To Be Received In An Ordered Way, Meaning If 5 Data Packets Are Sent, Then Data Packet 1 Should Be Received Before Data Packet 2. This Doesn't Happen In UDP Which Is A Connection Less And Works On The Principle Of Shoot The Data. The Working Principle Of UDP Is To Send The Data Without Taking Care Whether It Reaches Its Destination Or Not. The TCP Protocol Is Considered To Be A Complete Protocol And Therefore Is Used Many Times Over In Systems Than The Unreliable UDP.


    TRANSMISSION CONTROL PROTOCOL (TCP):

    TCP Stands For Transmission Control Protocol And It Guarantees Delivery Of Data Packets. This Protocol Provides Extensive Error Checking Mechanisms Such As Flow Control And Acknowledgment Of Data. Transmission Control Protocol (TCP) Is A Connection Oriented Protocol. Before Transmitting Data, A Connection Must Be Established Between The Devices Participating In Data Transmission.

    If Your Application Require Guaranteed Delivery Of Data, Then You Must Choose TCP As The Transport Layer Protocol.

    1) Transmission Control Protocol (TCP) Is A Connection Oriented Protocol, Which Means The Devices Should Open A Connection Before Transmitting Data And Should Close The Connection Gracefully After Transmitting The Data.

    2) Transmission Control Protocol (TCP) Assure Reliable Delivery Of Data To The Destination.

    3) Transmission Control Protocol (TCP) Protocol Provides Extensive Error Checking Mechanisms Such As Flow Control And Acknowledgment Of Data.

    4) Sequencing Of Data Is A Feature Of Transmission Control Protocol (TCP).

    5) Delivery Of Data Is Guaranteed If You Are Using Transmission Control Protocol (TCP).

    6) Transmission Control Protocol (TCP) Is Comparatively Slow Because Of These Extensive Error Checking Mechanisms.

    7) Multiplexing And Demultiplexing Is Possible In Transmission Control Protocol (TCP) Using TCP Port Numbers.

    8) Retransmission Of Lost Packets Is Possible In Transmission Control Protocol (TCP).

    USER DATAGRAM PROTOCOL (UDP):

    UDP Stands For User Datagram Protocol And It Operates In Datagram Mode. The Main Difference You Should Notice Here Is User Datagram Protocol (UDP) Is A Connection-Less Protocol.

    User Datagram Protocol (UDP) Has Only The Basic Error Checking Mechanism Using Checksums.

    1) User Datagram Protocol (UDP) Is Datagram Oriented Protocol With No Overhead For Opening, Maintaining, And Closing A Connection.

    2) User Datagram Protocol (UDP) Is Efficient For Broadcast/Multicast Transmission.

    3) User Datagram Protocol (UDP) Has Only The Basic Error Checking Mechanism Using Checksums.

    4) There Is No Sequencing Of Data In User Datagram Protocol (UDP).

    5) The Delivery Of Data Cannot Be Guaranteed In User Datagram Protocol (UDP).

    6) User Datagram Protocol (UDP) Is Faster, Simpler And More Efficient Than TCP. However, User Datagram Protocol (UDP) It Is Less Robust Then TCP.

    7) Multiplexing And Demultiplexing Is Possible In User Datagram Protocol (UDP) Using UDP Port Numbers.

    8) There Is No Retransmission Of Lost Packets In User Datagram Protocol (UDP).



    THE MOST IMPORTANT DIFFERENCES




    THE MOST IMPORTANT DIFFERENCES THAT ARE IN TCP vs UDP:


    RELIABILITY :

    TCP: Connection-Oriented
    UDP: Connectionless

    ORDERED :

    TCP: Order Of Message Receipt Is Guaranteed
    UDP: Order Is Not Guaranteed

    PROTOCOL WEIGHT :

    TCP: Heavyweight, Because Of The Connection/Ordering Overhead
    UDP: Lightweight, Very Few Overhead

    PACKETS :

    TCP: Streaming, Data Is Read As A "Stream," With Nothing Distinguishing Where One Packet Ends And Another Begins. There May Be Multiple Packets Per Read Call.

    UDP: Datagrams, One Packet Per One Read Call.

    CONCLUSION:


    The Goal Of This Article Is To Give An Easy Way To Understand The “TCP vs UDP”. Hope This Article Will Help Every Beginners Who Are Going To Start Cisco Lab Practice Without Any Doubts. Thank You And Best Of Luck.

    This Article Written Author By: Premakumar Thevathasan. CCNA, CCNP, CCIP, MCSE, MCSA, MCSA - MSG, CIW Security Analyst, CompTIA Certified A+.

    DISCLAIMER:


    This Document Carries No Explicit Or Implied Warranty. Nor Is There Any Guarantee That The Information Contained In This Document Is Accurate. Every Effort Has Been Made To Make All Articles As Complete And As Accurate As Possible.

    It Is Offered In The Hopes Of Helping Others, But You Use It At Your Own Risk. The Author Will Not Be Liable For Any Special, Incidental, Consequential Or Indirect Any Damages Due To Loss Of Data Or Any Other Reason That Occur As A Result Of Using This Document. But No Warranty Or Fitness Is Implied. The Information Provided Is On An "As Is" Basic. All Use Is Completely At Your Own Risk.





    The School Of Cisco Networking (SCN)
  • No comments: