[Ilugc] [OT] how does a Browser work?
binand at gmail.com
Mon Apr 25 08:30:12 IST 2005
On 25/04/05, peevee <peevee.chaitanya at gmail.com> wrote:
> can anyone tell me how a browser typically works....
> I mean, when i type a web address, how or where does it resolve the ip
> for that name,
> how does it know which server to contact for resolving it first??
> later i know that the dns is resolved and the packets reaches the
> respective server, and response comes accodingly,
> all i want to know is , the initial part..
Not just a browser, but any network-aware software does the initial
Every TCP/IP "stack" has a subsystem called a resolver - your browser
typically starts by asking the resolver to resolve a name into an IP
address. The resolver consults a configuration file - /etc/resolv.conf
on Unix - and asks the nameservers listed there (which is typically
the IP address(es) of the nearest DNS cache) to resolve the name for
it. The DNS cache performs a complex recursive lookup procedure, and
extracts the IP address associated with the name, caches the result
and tells your resolver what it got. The resolver in turn tells your
application the IP address. Then the browser switches its attention to
the socket subsystem of TCP/IP and tries to open a connection to the
IP address it got thus.
It is in reality somewhat more complicated (especially on Linux,
Solaris etc.), because another layer of abstraction exists between the
resolver and the application called Name Services. Depending on the
configuration in /etc/nsswitch.conf, this layer decides whether to
contact the resolver, the NIS database or simply your /etc/hosts to
figure out what IP address is associated with a given name.
More information about the ilugc