Hello everyone, I am quick-frozen fish 🐟, a water front 💦, like the garish 💐, continuous sand sculpture 🌲 Welcome friends to add my wechat: Sudongyuer pull you into the group of my public number: front-end quick-frozen fish progress together, looking forward to growing together with everyone

Read this article 📖

1. You will get a full view of the web by typing the URL to the browser to display the content

2. Get a big picture view of computer networks

3. To understand the computer network from a macro perspective and build a knowledge system of computer network, Yu Yu will follow the new chapter by chapter

4. I am full of interest and hobbies in basic knowledge and cultivate my interest in computer

Preface 🌵

Learning computer network for a long time, I found that the computer network is a very interesting topic, but its knowledge broad and deep, through learning I find that many books are one part of the deep to explain, is to let a person lose interest, from the URL into the browser display picture would allow us to have a comprehensive understanding to the network from zero to one

Knowledge 📒

Disconnect and delete the socket from the server

The operation sequence of the disconnect

(1) The client sends the FIN

(2) The server returns an ACK number

(3) The server sends the FIN

(4) The client returns the ACK number

After communication with the server is complete, the socket used for communication is no longer in use, at which point we can delete the socket. However, the socket is not deleted immediately. Instead, it waits for some time before being deleted.

This waiting time is often the content of the interview, why wait for a period of time to be deleted?

  • If the ACK number returned by the client is lost, the client socket has been deleted, but the server does not receive the ACK number and resends the FIN.
  • When a socket is deleted, it means that control information in memory is also deleted, just as a new application creates a socket that is assigned to the same port.
  • The server resends the FIN just as it arrives, causing the new socket to disconnect. The reason for not deleting the socket immediately is to prevent such misoperations.

IP and Ethernet packet sending and receiving operations

Network packet structure

  • The router determines the location of the next route based on the destination address
  • The hub transmits network packets to the next route in the subnet

The router corresponds to the IP layer, which is the network layer

Hubs correspond to the MAC layer, which is the physical layer

  • The IP protocol determines the location of the next IP forwarding device based on the destination address
  • The Ethernet protocol in the subnet transfers the packet to the next forwarding device

Let’s talk about the layered design of the network:

Why is it layered? Personal understanding is decoupled, easy to expand. The network layer does not need to care about the realization of the physical layer, so we can switch the devices and protocols of the physical layer at will (the physical layer can be wireless network card, wired, ADSL, FTTH).

Getting back to business, the IP module is responsible for adding two headers to the packet

  • MAC header: Ethernet header, including the MAC address
  • IP header: The header used for the IP address, including the IP address

Generate the IP address and IP header containing the receiver

Where does the IP address come from? It’s from the TCP module, because when we create a socket, we create it using the IP plus port, and that socket holds our control information.

The IP address in TCP is obtained from the application layer

Format of the IP header

In this case, the TTL can be focused on, in order to avoid the network loopback, a packet around the network.

Set Receiver IP address in the IP header to the IP address of the communication object. Sender IP Address Determine the NETWORK adapter used for sending packets and enter the IP address of the network adapter.

Query the MAC address of the target router through ARP

ARP is like a broadcast 📢, in a subnet, call, who is XXX IP address, can get the MAC address of that IP, IP protocol can add the MAC address to the IP header

The next step is to convert IP packets into electrical or optical signals and send them out

The ROM of the nic holds the world’s unique MAC address, which was written in production.

Nic driver After obtaining data packets from the IP module, the NIC stores them in the buffer of the NIC and sends the packet sending instruction to the MAC module. Then, the MAC header is added and the digital signal is converted into a universal signal that can be transmitted through the NETWORK cable through the PHY module of the NIC

Masthead: used to determine the timing, that is, the high and low timing of the electrical signal

SFD: Start frame separator, used to determine the start position of a frame.

The function of these two, the header is equivalent to the law of the electrical signal transmission, SFD used to indicate that a piece of data is the frame.

FCS: frame check sequence (used to detect whether the frame is disturbed by noise during transmission, resulting in data errors)

ICMP: ICMP is like an IP layer scout

The ICMP message

UDP sending and receiving operations

Data that does not need to be retransmitted is more efficiently sent using UDP, which is part of the transport control layer, as is TCP

And TCP reverse, very simple, the following to introduce his scenario

  • Short data for control
  • Audio and video data, real-time, effective

Conclusion 🍁

  • Basic knowledge of IP layer packet
  • Packet sending and receiving operations
  • Knowledge of physical layers
  • What is the ICMP
  • UDP Brief Introduction

References 📚

  • How the Web Is Connected
  • Diagram of TCP/IP
  • Illustrated HTTP
  • Computer Networking from top to Bottom
  • Lingo’s illustrated computer network

Conclusion 🌞

So my “from the URL to the web page 🌏” build a knowledge of computer network system – 04 was over, actually very simple, the purpose of the article is the summary of daily work and output, output some feel useful to everybody, food not food is not important, but love 🔥, hope everyone can like my articles, I am really very attentively in writing, Also hope to know more like-minded friends through this article, if you also like to toss, welcome to add my friend, sand sculpture, progress together.

Making 🤖 : sudongyu

Personal blog 👨💻: Frozen fish blog

Vx 👦 : sudongyuer

Write in the last

Guys, if you like my words, give 🐟🐟 a thumbs up 👍 or follow ➕ to support me the most.