One-stop learning Java network programming comprehensive understanding of BIO_NIO_AIO, learning notes (1)

Hi everyone, I’m 方圆
coming on! ! !


1. URL address construction and resolution

Insert picture description here
We look at the address above, under normal circumstances, the root domain name part of the root will be omitted. The URL parsing process is to parse from right to left, convert the address into an IP address, and access it.

1.1 The hierarchy of domain names

Insert picture description here

1.2 Two ways to query domain name DNS

1.2.1 Recursive query

Insert picture description here

  • As shown in the figure above, the browser sends the request to the DNS client, and the client requests the root domain name server to resolve the domain name. After the resolution is complete, it then visits the top-level domain name server to request it to resolve the domain name, and so on, until After all the resolution is completed, it is passed from the third-level domain name server to the DNS client layer by layer, and then sent to the browser.

1.2.2 Iterative query

Insert picture description here

  • Iterative query is to visit the root domain name server first after accessing the DNS client, and send all the contents of the domain name stored in the root domain name server to the DNS client. If domain name resolution cannot be achieved, the DNS client will request the top domain name server again. The process is the same as above. After the final analysis is completed, the request result is passed to the browser.

Tip:After the domain name is resolved once, its cache will be generated and stored in the DNS client. When the domain name is accessed again, it will no longer request various domain name servers. For the root domain name server, it is limited in the world. It has been built into the DNS client, so there is no need to worry about not knowing the address of the root domain name server.


2. Basic knowledge of network protocol

2.1 Layering and protocol

Insert picture description here

  • Application layer: specify the data format of the application
  • Transport layer: connection between ports
  • Network layer: the connection between hosts can achieve specific positioning
  • Link layer: The connection between network cards, each network card has its own MAC address, which has been determined when the network card is produced; if the data is transmitted through the MAC address, then it will send a copy to all sub-network hosts Data, and verify the MAC address when receiving, and accept only when they are consistent, which cannot achieve accurate positioning
  • Physical layer: The solution is the connection between computers, which is generally connected through optical cables

2.2 Data packet format of each layer

Insert picture description here
From the application layer down, the header of this layer will be added every time it passes. For the Ethernet header, its size is 18 bytes, and the rest of the data part is 1500 bytes, and its maximum size is 1518 bytes , That is, the bytes of each frame. When sending a larger file, multiple frames of data packets will be sent. Through the header information, they can be combined during reception to achieve correct data transmission.


dry!

Guess you like

Origin blog.csdn.net/qq_46225886/article/details/107452879