Friday, 23 May 2014

How does the internet work?

Who is this text for?


This text is intended as a help for primary teachers who are to begin teaching computer science in the coming academic year. It is specifically written for the level of understanding of a primary school pupil in order to be an aid for teachers. If you are in this position and have other computing questions I would be pleased to hear them. This text was written by Jennifer Deegan, using technical information contributed by Tim Deegan.

What is a computer network?


A computer network is a set of two or more computers, linked to one another using electric cable, radio waves, or beams of light in fibre optic cable. If more than two computers are linked, then there must be a computer at every junction in the network. Messages are passed like chinese whispers (or like a bucket chain), so they go from computer to computer to computer, through the network until they reach their destination.

What constitutes a "computer"


When we say a “computer” we do not just mean a laptop, desktop or tablet computer. We also include many other devices that contain internet linked computers. For example: a mobile phone, a central heating boiler that can be turned on from a mobile phone, a house burglar alarm which could send a message to the owners phone or PC, VoIP phones, set top boxes for watching TV,  satellites, and lots of other things.

The internet is a huge computer network


There are many millions of computers connected together across the world now. The total network is known as the  internet, and strictly speaking, it is a big network made up of many smaller networks. A lot of the computers are only there to pass information on from one part of the network to another. An example of such a computer would be the internet routers that we have in our houses to connect the internet outside the house to the laptops, desktops and tablet PCs inside.

The World Wide Web (www) runs on top the internet, and it is the set of services that people have developed to run on these networked computers.(Many people now use the terms "internet" and "www" interchangeably, and that's okay in most situations.) There are millions (or billions perhaps) of pages of information in the www, and they are all easily accessible to us. We can learn from them, just as if they were a giant encyclopedia. There are also shops and games and videos, and all sort of other interesting things. But how does our computer get hold of these pages and display them on our computer screen?

How does the internet actually work in detail?

How does a computer ask for and receive a web page?


Just as each house has a street address (e.g. 25 Primrose Lane) each computer has its own address IP address (Internet Protocol address). An IP address looks like this:  “172.16.254.1”.

When we type a website address or “url” (uniform resource locator) into the bar at the top of a browser window, the computer sends a message asking for that web page to be loaded into the browser window. The computer sends the computer name from the url (e.g. www.bbc.co.uk) to a special computer on the internet called a DNS server (Domain Name System Server). The DNS server may have to pass the message around a bit to get the full answer, but when the passing around has been done, then the DNS server will send back the ip address of the computer on which the website lives. Our computer can then send a message to that computer, asking for a copy of the webpage. Our browser will then load the new copy of the web page that we have requested into our browser window.

Sometimes we might wish to load the same webpage quite frequently, day after day, or week after week. In this case our computer would store a copy of the webpage in a place called the “cache”, so that the page can be reloaded again later. This means that the page can be reloaded from the cache without the computer having to request a new copy from the far away computer that holds the original copy.

What happens when we click on a link in a web page?


The DNS section above explained how the computer summons a web page originally from across the internet, but what happens when we click on a link within a webpage? For example, what happens when we click on the link “http://www.bbc.co.uk/iplayer/cbeebies/2014-05-12” from within the page “http://www.bbc.co.uk/cbeebies/games/”?


To understand that we need to understand three simple concepts: IP, TCP and HTTP:

1) IP (Internet Protocol)


Each computer has an IP address like “172.16.254.1”. When a computer sends a message to another computer using the IP system, the message goes from computer to computer to computer, across the internet. This is like playing chinese whispers with a lot of children. Imagine that one child (Katie) writes a message on a piece of paper and passes it, child to child to child, across the network of children, in the hope that it will eventually reach the right person (William). The mechanism is not totally reliable; it might work, but there is a chance that it won’t. IP is a simple system by which computer send messages across the internet, but it is not totally reliable.

2) TCP (Transmission Control Protocol)


TCP is another mechanism for sending messages from computer to computer across the internet. TCP is built using IP, so it is still like chinese whispers, but there are a lot of rules included to check that messages have been received. For example, a return message is always sent confirming that the message arrived; if this does not happen, then the original messages will be sent again. Also if several messages are sent, and they arrive out of order, then the TCP mechanism ensures that they will be put in the correct order at the destination. So TCP and IP are rather similar, but TCP is much more reliable.

3) HTTP (Hypertext transfer protocol)


You will have seen the abbreviation “http” a lot as it is at the beginning of every url. HTTP is not another mechanism for sending a message, but is a structured language in which the messages should be sent. Imagine that a class were talking to each other over walkie talkies. Katie might say “The ball is in the box, over” and William might reply “10-4, Katie” which means “message received”. On walkie talkies we use a very structured language for clarity. In the same way, computers use a very structured language when they send a message over TCP to ask for a webpage. The structured language is called “http”.

So what happens when we click on the link within a web page?


We might see a link like this “http://www.bbc.co.uk/iplayer/cbeebies/2014-05-12” within the main page  “http://www.bbc.co.uk/cbeebies/games/”. We can then click on this link. When we do this, the computer sends a message using http language, through its TCP connection, to the computer that holds the original copy of the website. The message asks the computer for the part of the website that corresponds to the sub-section of the website “/iplayer/cbeebies/2014-05-12”. That page will be sent back and quickly displayed in our browser window.

What can we use the internet for?


There are many useful facilities offered by the internet. The network makes it very easy for people to communicate in writing, by voice or video message. A person in the UK can have a video phone call with several other people in several countries all at the same time, to solve a complex problem. This is now a daily activity for business people, scientists, politicians, families and many others.


Big companies and charities offer many other services via the www. Google books is making online copies available of all (out of copyright) books. People can send instructions to their banks or companies like Paypal through secure systems via the www and so organise their money online. There are special shops that operate only online (e.g. Amazon and Play.com). We can write to newspapers or to our MPs and MEPs through the internet. Friends and organisations communicate through social networks such as facebook and twitter, and very serious work is sometimes done through such media - such as organising how to get safely to work in a place that is in the grip of a civil war.


There is also a lot of crime on the www and the government and the police are still working out how to establish laws to control this crime, and how detect and punish it. We have to be very careful when using the www to avoid being duped by criminals, and to avoid handing over our personal information to the wrong people.