Transcript Lecture 2

CS 7: Introduction to
Computer Programming
Java and the Internet
Sections 1.4-1.6,2.1
Review


What are the 3 control structures?
Project 1 handed out
Overview


Internet
Java and the Internet


Applets
Java and GUIs
The Internet
Collections of Computers

Network


internet


Connection of ≥ 2 networks
Internet


System for connecting ≥ 2 computers so can
share resources
The world-wide connection of computers that are
accessible to the public
IntraNet

An network set up confined to a particular
organization
Computer Roles

Client



Server


computer / software that gets information from
another computer
Web Browser - client software to get Internet
Resources
computer / software that provides a service to a
client
Protocol

set of rules defining how two systems
communicate
Application Layer Protocols

FTP



HTTP




File Transfer Protocol
Moving files between computers
HyperText Transfer Protocol
Moving hypertext between computers
HyperText - text documents with links to other
text documents
FTPS, HTTPS, SSH

Secure communication
What’s the address?

IP address



32-bit address to identify computer
Each computer connected has unique IP
Ex: 130.49.222.47
URLs

Uniform Resource Locator


address to resource (files or request some
processing be done) from the Internet
http://www.cs.pitt.edu/~hoffmanp/cs7.html

http


protocol
www.cs.pitt.edu


Fully qualified domain name (FQDN) of server machine
Domain name servers (DNS)


convert FQDN to IP address (130.49.220.23)
~hoffmanp/cs7.html

Path to resource on the server
Internet vs. WWW

World Wide Web (WWW) - 2 definitions



set of resources that can be gotten using
the HTTP protocol
set of HTTP servers ("web servers")
The WWW Works on top of the Internet
Java and the Internet
Java

Why use Java?



Portable
Internationalization (Unicode)
Network features




Many features and libraries promoting networking
Applets can be distributed over Internet
Designed with security in mind
Swing classes make creating GUIs easier, portable
Applets


Java programs that can be embedded in
HTML to run on your browser
Examples:


http://www.cse.ucsc.edu/~pohl/JBD/chap8/MiniCa
lcApplet.html
Games



http://java.sun.com/applets/other/Hangman/index.html
http://www.npac.syr.edu/projects/java/magic/Magic.html
Education


http://www.dhpc.adelaide.edu.au/projects/vishuman2/
http://www.stat.sc.edu/~west/javahtml/CLT.html
Difference Between Applets
and Applications

Applets – little applications

Run under a browser


No main() method
Security restrictions
Applet Loader


Applets loaded over the Internet are
loaded by an applet class loader
Uses verifier to check there are no




Stack overflows / underflows
Invalid register accesses and store
Illegal data conversion
Uses the applet security manager
Untrusted Applets

Put in a “Sandbox”. Restrictions on





Files, directories
Programs on your machine
System properties
Connecting to other computers
Windows the applet creates
Trusted Applets


Trusted applets don’t have these
restrictions
Trusted applets are applets that either:


Are installed on your machine
Are a signed applet with an identity you
mark as trusted
Graphical User Interface (GUI)

User-Interface (UI)


Text-based (DOS)
GUI (Windows XP)



Windows
Icons
Java has the Swing classes
Working from home



PuTTY
F-Secure SSH Client
Windows, Mac, UNIX and new lines
Getting Comfortable with
UNIX