Computer network transport layer]

Computer network transport layer

This is inside the inverted binary checksum algorithm reference: https://blog.csdn.net/dingmin1860/article/details/48268927

  • ARQ Automatic Repeat reQuest
  • Continuous ARQ protocol

Introduction

Transport layer is a boundary level, for the above application, the following are oriented data transmission

According to the needs of different users -

Reliable, connection-oriented, TCP

Unreliable, non-connection-oriented, UDP. Fast, low transport costs.

port

# 16, 0-65535

0-1023 reserved

1024-5000 temporary

Universal Port Number

FTP 21/TCP
DNS 53/UDP
HTTP 80/TCP
SMTP 25/TCP

Why do we need a transport layer

The network layer has to provide transport services, unreliable, lost packets.

End host system needs its own reliable transport.

Several concepts

Connection-oriented service

Connectionless service

Reliable service

Feedback retransmission

Two transport layer protocol

  • User Datagram Protocol user datagram protocol
  • Transmission control protocol transmission control protocol
  • Data transfer unit: packet

UDP

User Datagram Protocol user datagram protocol

Feature

  1. no connection
  2. It is the message transmission unit
  3. Small header
  4. Unreliable
  • The recipient does not need to send an acknowledgment message
  • It does not guarantee data integrity destination
  • Reduce the communications burden on the network

UDP header format

Source Port (16 bits), destination port (16), and checksum (16), message length (16), the data

Port Number : 16, to allow different port number 65535

Checksum : Checksum range UDP data packet header + body + pseudo header

Message length : in bytes, UDP header + 8 bytes of the data portion, the maximum length of 65535

UDP checksum

Dummy header (12 bytes)

4 (bytes) 4 1 1 2
Source IP address Destination IP address 0 17 UDP length

Calculation range checksum: the UDP pseudo header header + data +

12 (bytes) 2 2 2 2
Pseudo-header Source Port Destination port Message length Checksum data

The IP checksum calculation method: the binary one operation

UDP port numbers not only checked, also check the IP address

TCP

Transmission control protocol transmission control protocol

Feature

Connection-oriented

Three-way handshake to establish a connection agreement

To establish a connection on an unstable IP network

Client: Active open a network connection, a transmission section SNY, No. initialization sequence x

Server: passive open port, sending SNY y, and ACK x + 1

Client: transmitting ACK y + 1

reliable

Feedback retransmission mechanism

Three Strategies

  1. Stop waiting mode

It receives an ACK before sending the next packet

  • Continuous mode of operation (depending on the receiving end there is no cache)
  1. Back manner (cumulative acknowledgment ACK) go back n
  2. Select the retransmission mode
ARQ mechanism: a sliding window

Timer

The sender does not receive an ACK within the predetermined time, the time out and resend the considered data packet.

Problems: receive duplicate messages.

The recipient can be removed by repeating the message packet sequence number.

Continuous ARQ protocol

  • The sender may transmit a plurality of packets
  • Receiver generally used cumulative confirmed by: sending an acknowledgment for the last packet arrive out of order
Sliding window sliding windows

Can only achieve continuous sliding window ARQ protocol, may also perform flow control (speed sender and recipient matches)

  • The sender transmits data only in the "transmission window"
  • Receiving side receives only the data in the "receive window"

Byte stream and

Sliding window

Confirm the number of bytes

Continue timer

A TCP connection as long as the party received the other side of zero window notification, starts the timer duration.

If the timer expires, A transmission zero window probe packets . After receipt of the other party, given the current window value.

flow control

The sender sending rate is not too fast, not only to let the recipient had time to receive (to prevent loss of data), nor to make network congestion.

TCP sliding window mechanism may be implemented in the control flow (both transmitting data in a consistent rate)

Congestion Control

Fundamental

Within a certain period of time, part of the demand exceeds the available resources can provide, network performance will deteriorate. ---> Congestion

Solutions

Increase resources and reduce demand

TCP Congestion Control

TCP header format

The minimum length of 20 bytes

UDP vs. TCP

Congestion Control vs. Flow Control

(Column outline, will complement the updated ~!)

Anti binary code checksum algorithm

Reference: https://blog.csdn.net/dingmin1860/article/details/48268927

First, IP, ICMP, UDP and TCP packet has a header checksum field, size is 16bit, the algorithm is essentially the same.

When transmitting data, the data packet in order to calculate the checksum. You should be as follows:

1, the checksum field set to 0;

2, as the data to be verified in units of 16-bit numbers, sequentially summing the binary one;

3, the result is stored in the checksum field

When data is received, the packet checksum calculation is relatively simple, as follows:

1, as the header portion of 16 bits in units of digits, sequentially summing the binary one, comprising a checksum field;

2, the calculated checksum and checking whether the result is 0;

3, if it is equal to 0, is divisible description, the checksum is correct. Otherwise, the checksum is wrong, protocol stacks to discard the packet.

Guess you like

Origin www.cnblogs.com/christy99cc/p/11921098.html