搜索此博客

2013年2月16日星期六

What Happens When You Type an URL in Your Browser

A question that is often asked in an interview is: what happens when you type an url in your browser, for example: www.facebook.com.
This question tests your understanding of the top-down computer networking concepts.
This webpage provides a good solution:

http://igoro.com/archive/what-really-happens-when-you-navigate-to-a-url/

In summary, the things happen when you enter an url in your browser are as follows,

1. The browser at your side (client) looks up from your local DNS server to resolve IP address.
    1) If the IP address of the website is cached in the local DNS, then the IP address is returned.
    2) If the IP address is not found in the cache, the local DNS will look up from top level DNS servers.
2. The DNS server replies back with the IP address of the site.
3. Browser send an HTTP request to the server. It will set up a TCP connection to the server on port 80.
4. Server send back a TCP acknowledgement to the browser.
5. The TCP connection is set up between the browser and the server. The browser fetches index.html file from the /home directory from the website.
6. The server encapsulate the html file in the data packet to the client.
7. The client receive the data, decapsulate it and format it, then display the content on the browser.
8. The client stores the IP in DNS cache for future use.
9.When broswer closed, TCP connection is terminated.

没有评论:

发表评论