25.03.2013 Views

Cracking the Coding Interview - Fooo

Cracking the Coding Interview - Fooo

Cracking the Coding Interview - Fooo

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Solutions to Chapter 17 | Networking<br />

17 1 Explain what happens, step by step, after you type a URL into a browser Use as much<br />

detail as possible<br />

SOLUTION<br />

2 4 9<br />

<strong>Cracking</strong> <strong>the</strong> <strong>Coding</strong> <strong>Interview</strong> | Knowledge Based<br />

pg 84<br />

There’s no right, or even complete, answer for this question This question allows you to go<br />

into arbitrary amounts of detail depending on what you’re comfortable with Here’s a start<br />

though:<br />

1 Browser contacts <strong>the</strong> DNS server to find <strong>the</strong> IP address of URL<br />

2 DNS returns back <strong>the</strong> IP address of <strong>the</strong> site<br />

3 Browser opens TCP connection to <strong>the</strong> web server at port 80<br />

4 Browser fetches <strong>the</strong> html code of <strong>the</strong> page requested<br />

5 Browser renders <strong>the</strong> HTML in <strong>the</strong> display window<br />

6 Browser terminates <strong>the</strong> connection when window is closed<br />

One of <strong>the</strong> most interesting steps is Step 1 and 2 - “Domain Name Resolution ” The web addresses<br />

we type are nothing but an alias to an IP address in human readable form Mapping<br />

of domain names and <strong>the</strong>ir associated Internet Protocol (IP) addresses is managed by <strong>the</strong><br />

Domain Name System (DNS), which is a distributed but hierarchical entity<br />

Each domain name server is divided into zones A single server may only be responsible for<br />

knowing <strong>the</strong> host names and IP addresses for a small subset of a zone, but DNS servers can<br />

work toge<strong>the</strong>r to map all domain names to <strong>the</strong>ir IP addresses That means if one domain<br />

name server is unable to find <strong>the</strong> IP addresses of a requested domain <strong>the</strong>n it requests <strong>the</strong><br />

information from o<strong>the</strong>r domain name servers

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!