• UDP and TCP


    UDP

    • unreliable, just add de-multiplexing and error checking on data than IP.
    • Best effort datagram(数据报) service
    • Multiplexing enables sharing of IP datagram service
    • Simple transmitter & receiver
      • Connectionless: no handshaking & no connection state
      • Low header overhead
      • No flow control, no error control, no congestion control
      • UDP datagrams can be lost or out-of-order
    • Applications
      • multimedia (e.g. RTP)
      • network services (e.g. DNS, RIP, SNMP)

    UDP Datagram

    • 0-255

      • Well-known ports
    • 256-1023

      • Less well-known ports
    • 1024-65536

      • Ephemeral(短暂的) client ports
    • Source and destination port numbers

      • Client ports are ephemeral(短暂的)
      • Server ports are well-known
      • Max number is 65,535
    • UDP length

      • Total number of bytes in datagram (including header)
      • 8 bytes ≤ length ≤ 65,535
    • UDP Checksum

      • Optionally detects errors in UDP datagram(Because the error packet will be discard)

    UDP De-Multiplexing(解复用)

    • All UDP datagrams arriving to IP address B and destination port number n are delivered to the same process
    • Source port number is not used in demultiplexing

    UDP Checksum Calculation

    • UDP checksum detects for end-to-end errors
    • Covers pseudoheader(伪报头) followed by UDP datagram
    • IP addresses included to detect against** misdelivery(错误传输)**
    • The use of UDP checksums is optional
    • But hosts are required to have checksums enabled

    TCP

    • Reliable byte-stream service
    • More complex transmitter & receiver
      • Connection-oriented: full-duplex(全双工) unicast connection between client & server processes
      • Connection setup, connection state, connection release
      • Higher header overhead
      • Error control, flow control, and congestion(拥塞) control
      • Higher delay than UDP
    • Most applications use TCP
      • HTTP, SMTP, FTP, TELNET, POP3, …

    TCP Multiplexing

    • A TCP connection is specified by a 4-tuple(数组)
      • (source IP address, source port, destination IP address, destination port)
    • TCP allows multiplexing of multiple connections between end systems to support multiple applications simultaneously

    Reliable Byte-Stream Service

    • Stream Data Transfer:transfers a contiguous stream of bytes across the network, with no indication of boundaries
    • groups bytes into segments(部分)
    • transmits segments as convenient (Push function defined)
      Reliability: error control to deal with IP transfer impairments(损害)

    TCP Segment Format

    TCP Header

    Window Size:TCP protocol need ACK to ensure the packet be transported, if we receive ACK after every packet arriving, it will waste a lot of time.So we need the Window Size to tell us how many packet we can send one time.

    • 16 bits to advertise window size
    • Used for flow control
    • Sender will accept bytes with SN from ACK to ACK + window
    • Maximum win size 65535 bytes
    • TCP Checksum
    • Internet checksum method
    • TCP pseudoheader + TCP segment
  • 相关阅读:
    .NET中非对称加密RSA算法的密钥保存
    WGS84经纬度坐标到北京54高斯投影坐标的转换[转]
    [APPS] HTC Footprints & HTC Locations for MikG 2.x Read more:
    firefox+ssh无法看youtube视频的解决方案
    【转】sdemon命令实践
    How to share a custom ArcMap command (DLL)
    【转】sdemon命令实践
    红旗桌面版本最新运用法子和结果解答100例8
    红旗Linux桌面4.1文本安装过程图解(二)
    Ubuntu把在效能器范畴起更重要的脚色
  • 原文地址:https://www.cnblogs.com/vancasola/p/7683910.html
Copyright © 2020-2023  润新知