Title: The Internet
1The Internet
2The Internet is an open system
- Details publicly available
- A lot of software is free
- Lots of publicly available expertise available
via such things as newsgroups - Dangers with privacy
3Implications of open systems
- Wide variety of implementations, for example of
TCP/IP - Cost of implementation less
- High level of compatibility
- Wide variety of developers selling products
4Examples of open systems and code
- HTTP
- TCP/IP
- Java
- Linux
- Apache
5Network topolocies
- Bus network
- Ring network
- Hub network
6Bus network
Devices computers, printers etc
Terminator
7Ring network
Computer
Computer
Mass storage device
Printer
8Hub network
Ports
Backplane
9The Internet has a layered architecture
- Level of functionality
- Each level draws upon facilities in a lower level
- As you proceed downwards you get nearer the
computer - Achieves separation of concerns
10Internet history (i)
- ARPA started the ARPAnet network
- ARPAnet originally used the NCP protocol
- 1974 Cerf and Kahn developed TCP/IP
11Internet history (ii)
- Splitting of ARPAnet into MILnet and ARPAnet
- Renaming of ARPAnet as Internet
- Development of Web at CERN
- Development of new protocols to cope with huge
growth
12Internet protocols(i)
- Telnet, used for connections
- File Transfer Prototcol (FTP), used for file
transfer - Simple Mail Transfer Protocol (SMTP), used for
electronic mail - Kerberos, used for security functions
13Internet protocols(ii)
- Network File System (NFS), used for transparent
file sharing - Trivial File Transfer Protocol (TFTP), used for
fast transmission of files - Transmission Control Protocol (TCP), used for
fast transmission of files.
14Internet protocols(iii)
- User Datagram Protocol (UDP), used for fast
transfer of data, unreliable. - HyperText Transfer Protocol (HTTP), used for
transferring Web documents - Internet Protocol (IP), basic functioning of
moving data
15Identifying 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 address
- Domain naming uses symbolic names
16IP addresses
- IP 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.
17An example the class A address
7 bits
1 bit
24 bits
Network address
Computer address
7 bits used to identify network
24 bits used to identify computer
1 bit used to designate class A
18Dotted quad notation
Used to identify a computer, four 8 bit
quantities reflecting the 32 bits used in the
Internet
Example
101.23.111.128
19The 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
20Domain Name System
- Dotted quad suffers from a major problem
difficult to remember - Better for symbolic names to be used
- This is the purpose of the Domain Name System
(DNS)
21An example
Country of origin
www.gold.ac.uk
Name of the computer
Academic organisation, edu used in America
Name of organisation
22Some domains
- com, a commercial company
- edu or ac, educational insitution
- gov, governmental organisation
- mil, military organisation
- museum, museums
23Hierarchic naming
com edu gov uk fr
athena.cs.mit.edu
mit
The computer athena in the cs department at MIT
cs
athena
24import java.net. public class Whoami public
static void main(String args) throws
Exception if(args.length lt 1)
System.err.println( You need to supply a
Machine name") System.exit(1)
InetAddress a InetAddress.getByName(args0
) System.out.println(a)
25Client and servers
- A network can be envisioned as a set of clients
and servers - Servers provide a service, for example a Web
server delivers Web documents - Clients call on the services provided by a server
26Distributed 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.
27What 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.
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.
-
29- Make your water availableProvide 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.
-
30- Control brooms from afar
- Execute methods on Java objects that live on
remote machines. This is accomplished with Javas
- Remote Method Invocation (RMI).
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.
32Other Java technologies
- Enterprise Java Beans
- Separate out functionality from connection
- JINI
- Add and remove objects
33Concurrency
- Remember in Mickey there are lots of brooms at
the same pool - There 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
34Layers 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
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
36Ports and sockets
- A port is a logical TCP/IP idea, not to be
confused with a hardware port - Ports are used for data communications
- Numbered
- Some ports are dedicated to certain applications
37Some dedicated ports
- 80 is used for Web traffic
- 25 is used for the Simple Mail Transfer Protocol
- 110 is used for the Post Office Protocol version
3 email service - 21 is used for the File Transfer Protocol
38Sockets and server sockets
- A socket is a connection into a computer
- A server socket is used to create a socket on a
server - Java contains facilities for setting up sockets
and server sockets and connecting streams
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
40Sockets and data input in Java
Socket ss new Socket(igor.gold.ac.uk,
2048) InputStream is ss.getInputStream() Buffe
redReader 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
41Sockets and data output in Java
Socket ss new Socket(scorpio.gold.ac.uk,
2048)OutputStream os ss.getOutputStream()Pri
ntWriter 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
42The ServerSocket class
- Used 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.
43Streams
- Abstraction for arbitrary data streams
- e.g. System.out.println()
- System is in java.lang
- in out and err are static fields in System
- each is a stream (actually a subclass, e.g
PrintStream)
44- There are InputStreams and OutputStreams
- These are abstract classes
- Children are things like input byte streams
45Generating 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
46(No Transcript)
47(No Transcript)