--- transport layer transport layer protocols TCP and UDP protocols overview

  • The transport layer is oriented communication function in the highest level, the lowest level is user-oriented functions.Here Insert Picture Description

First, the role of the transport layer

Here Insert Picture Description

  • AP~n~Representatives of the various processes (communication between the host and host communication is not, in fact, communication between application processes)
  • IP协议Communication between the host and the host: the scope
  • 端口: Actually a port identifier marks which process data is sent, or which process should be handed over.
  • 运输层协议TCP and UDP scope: from process to process
  • 网络层(IP协议)It provides a logical communication between the host and 运输层(TCP/UDP协议)the logical end to provide communication between the application process

Transport layer functions and protocols:

  • In a host of processes often have multiple applications and multiple applications simultaneously another host in-process communication, indicating that the transport layer there are two very important functions: 复用and分用
  • Depending on the needs of the application, the transport layer requires two different transport protocols, i.e., 面向连接的TCPand无连接的UDP。

Based on points with port and reuseHere Insert Picture Description

  • TCP and UDP face different processes have different communication needs of packets, which will eventually be encapsulated into IP datagrams, the destination subdivided, split to split according to the protocol field in the IP datagram header , separation of TCP and UDP

Shielding effect
transport layer shields the high-level user detail below core network (e.g., network topology, routing protocol is employed), it makes the application process to see if there is a transport layer between the two entities端到端的逻辑通信信道

Second, the two protocols TCP / IP transport layer

  • This transport layer logical communications channel performance due to the transport of upper layer protocols use different but very different
  • 用户数据报协议UDP
    • Features: Fast, simple, unreliable
    • When the transport layer is employed 无连接的UDP协议, the logical communication channel such 是一条不可靠信道as with UDP, it is connectionless, it does not matter here is the concept of full-duplex, half-duplex.
  • 传输控制协议TCP :
    • reliable
    • Provides connection-oriented services: network layer in front of the virtual circuit and stresses datagram, the datagram is connectionless, the concept of which is the network layer, the transport layer is not how the lower layer is achieved. In the transport layer it appears to be a connection, but also one to one connection!
    • It does not provide a broadcast and multicast service, although the underlying transport network is not reliable, the bottom is not full duplex, but this corresponds to a logical communication channel 全双工可靠信道( 不用管下层怎么样additional TCP how to ensure reliable transmission, will later mentioned)
      Here Insert Picture Description
      application How to choose what kind of agreement?
      Here Insert Picture Description

Third, the concept of port

  • The process uses a computer 进程标识符to flag. However, each process should not let the computer's operating system to assign its process identifier, because different operating systems can lead to too much identifier format, easy to deal with. Usually it is the port number assigned by the same method
  • Flag port number with a port 16, it only has local meaning, only to flag 本计算机各个应用进程, port number of the same name of the computer is no different from a contact (non-computer communicate with each other). So when two computers communicate, you need to know the IP address and port number can.

Port Number two categories:

  1. 服务器端使用的端口号
    • Well-known port, the value is generally 0-1023 (common)
    • Registration port number value of 1024-49151. This range of port numbers must be in the IANA level, in order to prevent duplication. (Future for registering 有可能a port number is called well-known port number.)
  2. 客户端使用的端口号
    • Also known as ephemeral port number, the value is 49152-65535, leaving the client process to select a temporary use. (After the communication, the port number is released out)

Fourth, the User Datagram Protocol (UDP)

  • Unit called a transport protocol packet or a UDP user datagram
  • 特点 :
    1. Fast, unreliable and simple.
    2. UDP is a connectionless, i.e. without establishing a connection before sending data, thereby reducing the overhead and time delay before data transmission.
    3. UDP maximum effort delivery, does not guarantee reliable delivery, and regardless of the amount of data congestion level, made a get away.
    4. UDP是面向报文的The entire application layer packets to the IP datagram.
      • Long application layer to the UDP packet, it sends UDP packets long, how long do not cares, not split, no packet, once finished. Therefore, the application itself must select the appropriate size of the packet.
        Here Insert Picture Description
    5. UDP support of many, one to one, many to one, many to many interactive communication
    6. UDP header overhead small, only 8 bytes.
  • UDP only in the IP datagram service-oriented a little extra functionality:
    1. Multiplexing and demultiplexing functions
    2. Error detection function
      • IP datagram header has a header checksum, only to complete the inspection of the header.
      • UDP can also detect errors
  • 优点:Although UDP only provides unreliable delivery, but UDP has its particular advantages in some respects. Suitable for 高实时性and on 安全要求不是很高occasion, such as live video. ()

UDP header format

  • UDP has two fields : a header and data fields. Header field: 8 bytes, divided into four fields, each field in 2 bytes. The following structure:
    Here Insert Picture Description
  • Pseudo-header: when calculating the checksum, the temporary connecting together the "pseudo-header" and UDP User Datagram. To calculate the checksum.Here Insert Picture Description

Five, TCP protocol

Feature

  • TCP to achieve many functions, such as reliable transmission, flow control, congestion control, connection is established, the release connections
  • Protocol transfer unit is calledTCP报文段
  • Designed for TCP transport layer protocol.
  • Each TCP connection can have only two endpoints, each TCP connection only 点对点的(one to one)
  • Spectrum transmission to provide reliable, full duplex communication (both ends transceiver buffer ???), the byte stream oriented (UDP packet oriented)

Byte stream oriented concepts

  • The procedure shown below, and transmitted to the recipient of the transmission process stream of bytes: 0123456 ...... 21
    Here Insert Picture Description

TCP connection

  • Endpoint not host TCP connections, nor is the IP address of the host, nor is the application process, nor is the transport layer protocol port (port and application process lacks distinction), it is called TCP connection endpoints 套接字或插口.
  • Here Insert Picture Description
  • Sockets actually indicates which application process on which host.
  • Each TCP connection has two ends, so there are two connection ports TCP sockets composition:
    Here Insert Picture Description
  • TCP is a connection 虚连接rather than a real physical connection exists. (Both sides acknowledge that there is a connection, but there is actually wood)
  • TCP applications for long once the message is sent to the TCP cache is not concerned with the application made on how the hair so, as long as the cache memory on the line. However, when the data in the cache when the outbound messages of the TCP is determined by.
    • TCP is given according to the other side 端口值和当前网络拥塞的程度to determine a segment should contain the number of bytes. It may be too short partial data blocks that may be forwarded together with the accumulated first byte is stored for a while. (UDP packets sent is completely determined by the process)
Published 22 original articles · won praise 0 · Views 136

Guess you like

Origin blog.csdn.net/weixin_42649617/article/details/104974369