Top Banner
1 The Internet
47

1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

Mar 28, 2015

Download

Documents

Avery Steele
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

1

The Internet

Page 2: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

2

The Internet is an open system

Details publicly availableA lot of software is freeLots of publicly available expertise available via such things as newsgroupsDangers with privacy

Page 3: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

3

Implications of open systems

Wide variety of implementations, for example of TCP/IPCost of implementation lessHigh level of compatibilityWide variety of developers selling products

Page 4: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

4

Examples of open systems and code

HTTPTCP/IPJavaLinuxApache

Page 5: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

5

Network topolocies

Bus networkRing networkHub network

Page 6: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

6

Bus network

Terminator

Devices: computers, printers etc

Page 7: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

7

Ring network

ComputerComputer

PrinterMass storage device

Page 8: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

8

Hub network

Ports

Backplane

Page 9: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

9

The Internet has a layered architecture

Level of functionalityEach level draws upon facilities in a lower levelAs you proceed downwards you get nearer the computerAchieves separation of concerns

Page 10: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

10

Internet history (i)

ARPA started the ARPAnet networkARPAnet originally used the NCP protocol1974 Cerf and Kahn developed TCP/IP

Page 11: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

11

Internet history (ii)Splitting of ARPAnet into MILnet and ARPAnetRenaming of ARPAnet as InternetDevelopment of Web at CERNDevelopment of new protocols to cope with huge growth

Page 12: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

12

Internet protocols(i)Telnet, used for connectionsFile Transfer Prototcol (FTP), used for file transferSimple Mail Transfer Protocol (SMTP), used for electronic mailKerberos, used for security functions

Page 13: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

13

Internet protocols(ii)Network File System (NFS), used for transparent file sharingTrivial File Transfer Protocol (TFTP), used for fast transmission of filesTransmission Control Protocol (TCP), used for fast transmission of files.

Page 14: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

14

Internet protocols(iii)User Datagram Protocol (UDP), used for fast transfer of data, unreliable.HyperText Transfer Protocol (HTTP), used for transferring Web documentsInternet Protocol (IP), basic functioning of moving data

Page 15: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

15

Identifying computers on the Internet

A basic function of any network is naming: identifying computers and other resources using some unique name.Dotted quad notation identifies an IP addressDomain naming uses symbolic names

Page 16: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

16

IP addressesIP addresses expressed in dotted quad identify a computer. Addresses can be class A, class B, class C or class D. They identify a network and a computer on the entwork.

Page 17: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

17

An example: the class A address

Network address Computer address

1 bit 7 bits 24 bits

1 bit used to designate class A

7 bits used to identify network

24 bits used to identify computer

Page 18: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

18

Dotted quad notation

Used to identify a computer, four 8 bit quantities reflecting the 32 bits used in the Internet

101.23.111.128Example

Page 19: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

19

The loopback address

The address 127.0.01 is known as the loop-back address.

Any data which is sent to this address from a computer will return straight to the computer

Page 20: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

20

Domain Name SystemDotted quad suffers from a major problem: difficult to rememberBetter for symbolic names to be usedThis is the purpose of the Domain Name System (DNS)

Page 21: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

21

An example

www.gold.ac.uk

Name of the computer

Name of organisation

Academic organisation, edu used in America

Country of origin

Page 22: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

22

Some domainscom, a commercial companyedu or ac, educational insitutiongov, governmental organisationmil, military organisationmuseum, museums

Page 23: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

23

Hierarchic naming

com edu gov …… uk fr

mit

cs

athena

athena.cs.mit.edu

The computer athena in the cs department at MIT

Page 24: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

24

import java.net.*;

public class Whoami {

public static void main(String[] args)

throws Exception {

if(args.length < 1) {

System.err.println(

“You need to supply a Machine name");

System.exit(1);

}

InetAddress a =

InetAddress.getByName(args[0]);

System.out.println(a);

}

}

Page 25: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

25

Client and serversA network can be envisioned as a set of clients and serversServers provide a service, for example a Web server delivers Web documentsClients call on the services provided by a server

Page 26: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

26

Distributed Computing in Java

"The Network is the Computer"--Scott McNealy, CEO of Sun Microsystems

Make computing across networks as simple and reliable as stand-alone computing

In Java, programming across networks is based on simple IO. So we will review that.

Page 27: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

27

What are the main distributed computing tasks: Remember Mickey

Mouse Fetch the Water:

Fetch some information from a distant machine machine over there and move it to this machine here, or vice versa.

The easiest way to do this is via Sockets. This is based on streams and is very like IO. We will start our Java here.

Page 28: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

28

Make a connection to a water supply:

Connect to a database, possibly residing on one or more other machines.

Java DataBase Connectivity (JDBC), is an abstraction away from the messy, platform-specific details of SQL.

We will start with the messy way.

Page 29: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

29

Make your water available:Provide services via a Web server. Three ways to do this in Java:

Applets: download the Java Code and run it on your own machine

Servlets: run it on the Web server

Java Server Pages (JSPs)incorporate in web pages.

Page 30: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

30

Control brooms from afar:

Execute methods on Java objects that live on remote machines. This is accomplished with Java’s

Remote Method Invocation (RMI).

Page 31: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

31

Integrate with other pre-written spells.

Use code written in other languages, running on other architectures.

Common Object Request Broker Architecture (CORBA), which is supported In Java.

Page 32: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

32

Other Java technologiesEnterprise Java Beans

Separate out functionality from connection

JINI Add and remove objects

Page 33: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

33

ConcurrencyRemember in Mickey: there are lots of brooms at the same poolThere are essentially two ways to do this:

HeavyWeight Processes: keep them quiet separate

LightWeight Proceses: interleave them

Java supports Lightweight processes through the use of threads

Page 34: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

34

Layers of Distribution in Java

1. Sockets

The model here is computer to computer connection

2. RMI (Remote Method Invocation)The model here is object to object connection. Relies on the same semantics, probably same language And still need to know where it is

Page 35: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

35

3. CORBA (Common Object Request Broker Architecture)

Here the language and location are abstracted away.

4. Voyager and mobile agents Here objects can be moved

Page 36: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

36

Ports and socketsA port is a logical TCP/IP idea, not to be confused with a hardware portPorts are used for data communicationsNumberedSome ports are dedicated to certain applications

Page 37: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

37

Some dedicated ports80 is used for Web traffic25 is used for the Simple Mail Transfer Protocol110 is used for the Post Office Protocol version 3 email service21 is used for the File Transfer Protocol

Page 38: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

38

Sockets and server sockets

A socket is a connection into a computerA server socket is used to create a socket on a serverJava contains facilities for setting up sockets and server sockets and connecting streams

Page 39: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

39

Address of Computer: IP Address

Address of a connection to a computer: Port (e.g. 25 for telnet)

Communication Channel through a port: Socket

Page 40: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

40

Sockets and data input in Java

Socket ss = new Socket(“igor.gold.ac.uk”, 2048);InputStream is = ss.getInputStream();BufferedReader bf = new BufferedReader (new InputStreamReader(is));

Creates a BufferedReader to the computer igor at Goldsmiths College via port 2048, data can now be read from igor

Page 41: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

41

Sockets and data output in Java

Socket ss = new Socket(“scorpio.gold.ac.uk”, 2048);OutputStream os = ss.getOutputStream();PrintWriter pw = new PrintWriter(os, true):

Sets up a PrintWriter object attached to the computer scorpio at Goldsmiths College. The client can then write data to this computer. Note that true in the PrintWriter constructor flushes data from the buffer automatically

Page 42: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

42

The ServerSocket classUsed to generate sockets at a server.Has a constructor which specifies the port to be used.Method accept blocks until a client connection is made and then generates a Socket object.

Page 43: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

43

StreamsAbstraction for arbitrary data streamse.g. System.out.println()

System is in java.langin out and err are static fields in System

each is a stream (actually a subclass, e.g PrintStream)

Page 44: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

44

There are InputStreams and OutputStreams

These are abstract classes

Children are things like input byte streams

Page 45: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

45

Generating streams at a server

ServerSocket ss = new ServerSocket(200);//Wait for a connectionwhile (true)

{ System.out.println (“waiting for client”);

Socket Client = ss.accept();

InputStream is = sockS.getInputStream();OutputStream os = sockS.getOutputStream();// is and os can then be used for communication// to the server

Page 46: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

46

// Time Server

import java.net.*;import java.io.*;import java.util.*;

public class TimeServer {

public static void main (Stringargs[]) throws IOException {

int port = 1234;

ServerSocket server = newServerSocket(port);

while (true) { System.out.println("Waiting for

client..."); Socket client = server.accept();

System.out.println("Client from"+client.getInetAddress()+"connected.");

OutputStream out =client.getOutputStream();

Date date = new Date(); byte b[] =

date.toString().getBytes(); out.write(b);}

}

Page 47: 1 The Internet. 2 The Internet is an open system Details publicly available A lot of software is free Lots of publicly available expertise available via.

47

// TimeClient

import java.net.*;import java.io.*;

public class TimeClient {

public static void main (String args[]) throws IOException {

Socket server = new Socket ("localhost",1234);

System.out.println("Connected to"+server.getInetAddress());

InputStream in = server.getInputStream();

byte b[] = new byte[100]; int num = in.read(b);

String date = new String(b);

System.out.println("Server said: "+date); }}