tcp ip basics

TCP

Format

TCP Message (Segment) Format

tib-1.png

Connection

TCP Connection Establishment Process: The "Three-Way Handshake"

tib-2.png

TCP Connection Termination Process: The "Four-Way Handshake"

tip-3.png

TCP Connection Establishment and Termination

tip-4.png

Basic

  • TCP Sequence and Acknowledgment Numbers
  • TCP Sliding Windows, with Flow Control, and Congestion Control

Reference

Features

  • Ordered data transfer — the destination host rearranges according to sequence number
  • Retransmission of lost packets — any cumulative stream not acknowledged is retransmitted
  • Error-free data transfer
  • Flow control — limits the rate a sender transfers data to guarantee reliable delivery. The receiver continually hints the sender on how much data can be received (controlled by the sliding window). When the receiving host's buffer fills, the next acknowledgment contains a 0 in the window size, to stop transfer and allow the data in the buffer to be processed.
  • Congestion control

UDP

Format

UDP Message Format

tip-5.png

UDP vs. TCP

TCP

  • 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

  • Easy to use, you just read and write data like its a file
  • 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

Reliable UDP

  • UDT(UDP-based Data Transfer Protocol)
  • RUDP(Reliable User Datagram Protocol)
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容