首頁  >  文章  >  系統教程  >  你在瀏覽器輸入URL都經歷了什麼過程

你在瀏覽器輸入URL都經歷了什麼過程

WBOY
WBOY原創
2024-08-08 08:16:02904瀏覽

你在瀏覽器輸入URL都經歷了什麼過程

一:相關概念說明:
 1.1: DNS(Domain name System)快取:(網域名稱系統)(查看本機的ipconfig/displaydns)

當電腦把一個網域解析完之後,它把這個這個網域和那個主機Ip位址相關聯起來了,電腦吧這個關係存到DNS快取表中,下次電腦再輸入www.baidu.com的時候,電腦透過尋找DNS快取,就可以知道這個網域對應的IP位址了,不再進行網域解析了,提高了效率

 1.2: ip位址:
     ip位址對應好像門牌號碼,我們透過這個位址可以找到主機的位置
1.3:網域:(domain name):
Ip地址是4個數字,用頓號隔開,這個東西不好記,我們一般用字母搭配數字的方式使用比如.www.baidu.com.,Ip地址和域名不是一一對應的,一個域名可以綁定多個IP,但在同一時刻一個網域只能解析成一個Ip位址(這個活由我們的DNS幫我們完成)
二:相關請求大致流程
1:瀏覽器根據網域解析出來Ip位址
2:瀏覽器依IP位址進行Socket通訊
3:瀏覽器和客戶端進行通訊,瀏覽器請求,伺服器接收請求
4:瀏覽器和伺服器斷開連結
三:具體的流程
3.1:查找過程
    1:瀏覽器先從自己DNS表中找出看有沒有.www.baidu.com(對應的IP位址)
    2:從作業系統中的DNS表中找出(維護網域名稱與ip位址對應關係的一張表)
    3:從作業系統host資料夾中尋找
    4:作業系統將網域傳送到LDNS(本地區域網域名稱系統),例如我在工大,那麼LDNS伺服器就在      我們學校, 尋找DNS快取,繼續失敗的話傳送一個迭代的DNS解析請求.
4.1:LDNS向Root name server(根網域伺服器,儲存每個網域的網域),Root name Server傳回com網域的頂級網域名稱伺服器位址
4.2:LDNS向com頂級網域名稱伺服器發送請求,返回www.bai.com網域名稱伺服器的位址
4.3:LDNS向www.baidu.com網域名稱伺服器發送請求,得到www.baidu.com的ip位址
  5:LDNS得到Ip位址返給作業系統,並且把這個iP位址快取到DNS表中
  6:作業系統將位址回傳給瀏覽器.同時也將IP位址快取起來
  7:現在瀏覽器已經得到Ip位址
3.2:建立連線(三次握手)(採用TCP協定)
   知道了百度的Ip位址,接下來是三次握手的實現連結
  1:客戶機向伺服器發送建立連線請求(你好,很高興認識你)
  2:伺服器接到請求後發送同意連線請求(好的,很高興認識你)
  3:客戶機接收到伺服器同意請求後,再次向伺服器發送確認訊號(我也很高興認識你),自此主機和伺服器兩個建立連線
3.3:網頁請求和顯示
After the connection is established, communication will occur between the server and the client
3.1: The client browser generates an Http request based on the IP address, including the location of the file and the request method
3.2: The server receives the http request content and decides how to obtain the corresponding HTML file
3.3: The server sends the corresponding HTML file to the browser
3.4: Before the browser fully receives the HTML file, it starts rendering and displaying the web page
3.5: Continue to request pictures according to the html code,
3.4: Disconnection process (four waving processes)
1: The client sends a disconnect request to the server (it’s late, I should go)
2: The server receives the request and sends a signal to confirm the request (got it)
3: The server sends a disconnect notification to the client (it’s time for me to leave)
4: The client receives the disconnection notification and feeds back a signal (ok), and the server receives the feedback signal and disconnects the link

以上是你在瀏覽器輸入URL都經歷了什麼過程的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn