Search This Blog

Thursday, July 5, 2012

Internet, web, protocols...

Today i was taught about the internet, how websites work, web services and some protocols. Here i share my knowledge about them.
The process of fetching a web page.
I am trying to be brief here..
  • User types the name of a website in browser(client)
  • browser sends a request (HTTP protocol is used..we will see more about HTTP later)
  • request reaches ISP
  • request then reaches DNS (Domain Name server)
  • The DNS gives the IP associated with the website name.
  • Using the IP the request reaches the server in which the required webpage is found.
  • The server actually consists of web server and application server
  • web server sends business logic to be processed to application server
  • Application server then returns plain HTML removing all scripting languages(server side) after processing.
  • This HTML page is sent as a response by the webserver
  • The browser receives this response and then displays it for the user to see.
So thats the overall process expressed in very simple terms.
There were points about web server and application server above.Lets see what they are here.

Web Server:
A web server exclusively handles HTTP requests alone.
When a HTTP request arrives it responds with either a plain HTML or delegates dynamic response to some other server side program( In the presence of an application server this process would be done by it). The Web server doesn't provide any functionality beyond simply providing an environment in which the server-side program can execute and pass back the generated responses.
Now i hope you understand what a web server is ! Next we see about application server.

Application server:
An application server exposes business logic to clients. It supports many protocols other than HTTP. Separating application server from web server has its advantages. When business logic functions are separated code re-usability increases greatly. You may ask how? ! Let me explain..
Suppose there are two web pages and both need to calculate volume of a cube at some point of time.
Without an application server the code to calculate volume has to be written in both the pages for processing.
However when we use application server the code to calculate volume of cube will be at application server and the two pages can simply call the function.
I think that must make clear the concept of web servers and application servers.
Another term you would have come across in the above paragraphs is HTTP. Lets see about that now.
HTTP:
HTTP stands for Hypertext transfer protocol. It's an application level protocol. You may wonder what’s a hypertext? and how it's different from normal text. In very simple terms hypertext is any text that links to some other text and so interactive in a way. There will be lot of linear paths following these links.

Now we use HTTP v 1.1. It has certain advantages over the previous version 1.0. Lets check out what they are here...

HTTP 1.1 has persistent connections as opposed to 1.0. HTTP is basically about request and response.
In v1.0 each request response is made using a new TCP connection. This makes the HTTP a stateless protocol. Wondering what’s the meaning of stateless??
It means the browser/server is unaware of previous request/response during the current request/response. State of the page is not saved. Hence the name stateless.
HTTP 1.1 has better caching capabilities with the introduction of fields like if_modified...

That pretty much sums about what HTTP is.
Last line of HTTP had a point about caching. For those wondering what it is..here is my explanation.
Caching:
Web servers employ a technique called caching to avoid unnecessary processing. When the content of the page is already served and no new changes are made then the cached content is sent by the web server directly as a response. Whenever the page is updated or modified the cache is cleared so that clients won't be seeing stale contents.

My most favorite topic of the day is cookies and sessions. Lets see about them now.
Cookies:
Cookies have a kind of myth surrounding it. People sometimes think of it as program installed on local machine by web pages. Truth is cookies are small pieces of text stored in client which can be retrieved by the web page.
Cookies help in personalizing page according to an user. However it's most important use according to me is for making “remember me” or “keep me logged in” functions in web pages.
A cookie can store session id along with ip address (sometimes) and identify an user so that he doesn't have to type his password again and again.
And people don't get alarmed..cookies don't store passwords. Mostly they store encrypted session ids and user ids only.
Sessions:
Sessions are similar to cookies ..but they are stored in the server. So once u close the browser a session is lost !

Today's entry is becoming longer and longer !! only few more topics to discuss.. stay with me i will explain them as briefly as possible.
E-Tag:
These are tags/ids given to resources in a web page like images. E-Tags gets changed when the resource’s content changes. Hope you already understood it's purpose. E-Tags are compared when a web page is loaded and unmodified items are loaded straight from cache. This is available in HTTP 1.1
FTP:
It's a protocol for transferring files from one host to another. It is one of the oldest protocols. It uses user-name and password for authentication. Some servers also allow anonymous users to enter their directory and download files.
SSH:
I have not heard about this protocol earlier... SSH stands for secure shell !! Upon some googling found that it's a for secure data communication, remote shell services or command execution and other secure network services between two networked computers connected via a secure channel over an insecure network.
SCP:
SCP → Secure copying. As the name suggests it’s a protocol for copying FILES ( only files not directories.. so it's not used naturally) in a secured way
SOAP:
SOAP stands for Simple Object Access Protocol..its a communication protocol for communicating between applications. It's a format for sending messages.. It's written as XML file. The response is also in XML.
REST:
Representational state transfer is similar to SOAP. But it's considered superior to SOAP. This is mainly because REST can be HTTP based whereas SOAP cannot. SOAP is based only on XML. So parsing had to be done to retrieve the results of a SOAP request.

Thanks for reading this long entry about internet and protocols..see u in next post !!


Trained @ Sourcebits

No comments:

Post a Comment