Computer network

  1. architecture

    Application layer: DNS, HTTP, SMTP, and FTP Transport layer: TCP and UDP Network layer: IP data link layer Physical layer

  2. Differences between TCP and UDP

    TCP protocol is connection-oriented, reliable transmission, word-throttling, low efficiency, flow control, congestion control UDP protocol has no connection, unreliable transmission, packet loss may occur, datagram as the basic unit, high efficiency

  3. TCP packet segment: the header and data header contain 20 bytes, including seQ, ACK, SYN, and FIN, source port number, and destination port number

    Seq Indicates the sequence number of the first byte of the data to be generated. Ack indicates that the highest sequence number of the received data is added by 1, that is, the SEQUENCE number of the first byte of the received data is expected to be 1. SYN=1 indicates that this is a connection request or connection received packet. Indicates that the sender of the packet has finished sending the packet and wants to release the connection

  4. How does TCP achieve reliable transmission? What happens if you send data and do not receive an ACK acknowledgement?

    • Acknowledgement reply + SEQUENCE number: During TCP transmission, after receiving a packet, the receiver sends an ACK packet to the sender. This ACK packet carries the ACK number to tell the sender what data it has received and where to start sending the next data. Second, the receiver can sort and de-duplicate the packets according to the serial number of the packet header, and then send the data to the application layer.

    • Timeout retransmission: After sending data, the sender starts a timer. If the sender does not receive an ACK packet within a certain period of time, the sender resends data until the number of retransmission times reaches or the ACK packet is received. When the number of retransmission times reaches a certain number, TCP considers that the network is abnormal and forcibly closes the connection.

    • Fast retransmission: If the serial number of the packets received by the receiving side is incorrect, the receiving side repeatedly sends the previous ACK packet. If the sender receives three CONSECUTIVE ACKS with the same ACK number, the sending side starts fast retransmission and resends the packets corresponding to this ACK packet.

    • Sliding window: the sending window of a sliding window, which will not slide until an ACK acknowledgement is received

      Send window: sent, not received ACK, not sent, but allowed to send Accept window: not received but ready to receive

  5. How does TCP prevent data duplication?

    The receiver sorts and de-duplicates the packets according to the serial number of the packet header and sends the data to the application layer.

  6. Three handshakes to establish a connection

  7. Wave four times to release the connection