18-1 Client-Server Computing Protocols Communications protocol : a - - PDF document

18 1
SMART_READER_LITE
LIVE PREVIEW

18-1 Client-Server Computing Protocols Communications protocol : a - - PDF document

Overview Topics Packet switched networks TCP/IP CSE 143 Java Autumn 2001 Name servers - DNS Higher-level protocols: file transfer (FTP), mail (SMTP, POP), news (NNTP), web (HTTP) For further information The


slide-1
SLIDE 1

18-1

12/12/2001 (c) 2001, University of Washington 18-1

CSE 143 Java – Autumn 2001

The Internet From 50,000 Feet

12/12/2001 (c) 2001, University of Washington 18-2

Overview

  • Topics
  • Packet switched networks
  • TCP/IP
  • Name servers - DNS
  • Higher-level protocols: file transfer (FTP), mail (SMTP, POP), news

(NNTP), web (HTTP)

  • For further information…
  • Internet section of your favorite bookstore
  • The Internet Book by Douglas Comer (P-H, 3rd ed, 2000)

12/12/2001 (c) 2001, University of Washington 18-3

Browsing the Web

  • Enter a web address in a browser
  • Web page appears
  • What just happened?
  • How did your machine find the machine on the net with the page?
  • How did the packets get transferred across the net?
  • What’s going on here?

12/12/2001 (c) 2001, University of Washington 18-4

Circuit Switching & Packet Switching

  • Circuit switching
  • End-to-end circuit set up for communication
  • Traditional analog telephone system
  • Packet switching
  • Digital messages
  • Bits of message are chopped up into short packets
  • Packets are shipped from source to destination independently of

each other

  • Wires are shared by different sessions simultaneously
  • Method used by the internet (dates back to ARPANet in late 60’s)

Now replacing traditional circuit switching for voice, etc.

12/12/2001 (c) 2001, University of Washington 18-5

Local Area Networks

  • Computers connected in a small area (office, house)
  • Network is high-bandwidth, reliable
  • Typical connection technology
  • Ethernet
  • Wireless

12/12/2001 (c) 2001, University of Washington 18-6

Internet

  • Idea: Local networks are connected to internet a router
  • Packets are transmitted by injecting them into the network
  • Packets are self-identifying (source/destination addresses, etc.)
  • Network is responsible for forwarding packets – routers

Internet

slide-2
SLIDE 2

18-2

12/12/2001 (c) 2001, University of Washington 18-7

Client-Server Computing

  • Much of the communication on the net is some sort of client-

server computing

  • Server: a program that runs continuously, waiting for

requests (directory lookup, email, web server)

  • Client: program that sends a request to a server

client server

send me my email here it is

12/12/2001 (c) 2001, University of Washington 18-8

Protocols

  • Communications protocol: a standard specifying the kinds of

messages exchanged between particular kinds of clients and servers

  • Examples:
  • SMTP (outgoing mail), POP (incoming mail)
  • IMAP (different email protocol)
  • LDAP (directory lookup)
  • FTP (file transfers)
  • HTTP (web server requests)
  • HTTPS (secure web server)
  • SSL (Secure Sockets Layer)

12/12/2001 (c) 2001, University of Washington 18-9

Protocol Stack

  • Actual communication is done via intermediate protocols
  • Fundamental ones:
  • IP: Internet protocol – basic packet delivery
  • TCP: Transmission Control Protocol – message transmission

Hardware IP TCP Application Hardware IP TCP Application

Hardware connection Virtual (software) connection

12/12/2001 (c) 2001, University of Washington 18-10

IP – Internet Protocol

  • Packet delivery from one internet host to another
  • Packet size is fairly small – few thousand bytes
  • IP handles details of routing from source to destination
  • Each router in the net has routing tables with its current best guess
  • f how to forward packets to move them towards their destinations
  • Packet delivery is on a “best efforts” basis
  • No guarantees – packets will be discarded if something goes wrong

(transmission errors, router unable to keep up with traffic volume, etc.)

12/12/2001 (c) 2001, University of Washington 18-11

Internet Addresses

  • Every machine on the internet has a unique IP address
  • Current IP addresses are 32-bits
  • Typically written as 4 decimal numbers, one per byte. Examples

128.95.4.112 (www.cs.washington.edu) 208.48.26.246 (www.nytimes.com)

  • IP addresses may be
  • static – fixed address assignment
  • dynamic – assigned when computer establishes connection to the

net (DHCP)

  • IP addresses are assigned in blocks
  • 128.95.4.nnn belong to cs.washington.edu

12/12/2001 (c) 2001, University of Washington 18-12

TCP – Transmission Control Protocol

  • Provides reliable delivery of arbitrary length messages
  • Sending TCP agent breaks message up into packets and

transmits via IP

  • Packets contain time stamps, serial numbers, and other header info

in addition to message data

  • Receiving TCP agent reassembles packets into messages

and acknowledges receipt

  • TCP handles retransmission of missed packets
  • Packets may arrive out of order & there may be duplicates
  • Most basic internet services are built on TCP
slide-3
SLIDE 3

18-3

12/12/2001 (c) 2001, University of Washington 18-13

Naming Computers

  • Numeric IP addresses are fine for computers; not people
  • Computers on the internet typically have names
  • Each machine has (at least one) name

perkins-pc.cs.washington.edu www.amazon.com

  • Names are organized into domains – typically allocated to an
  • rganization or part of an organization

washington.edu; cs.washington.edu; amazon.com; sun.com; java.sun.com whitehouse.gov

  • Each name is associated with an IP address
  • No particular connection between names and specific IP addresses;

up to organization to assign addresses

12/12/2001 (c) 2001, University of Washington 18-14

Name Lookup - DNS

  • A domain name must be translated to an IP address before

communication can be established

  • Every domain on the net runs a Domain Name Server (DNS)
  • Handles translation requests for that domain (both local & outside)
  • To translate a non-local name, contact its domain server
  • Contact DNS for cnn.com to get IP address for www.cnn.com
  • If all-else fails, contact top-level domain servers to get
  • rganization domain server IP address
  • com, edu, net, org, gov, etc.

12/12/2001 (c) 2001, University of Washington 18-15

Higher-Level Protocols

  • Many basic protocols are built on top of TCP
  • Protocols describe detailed formats of messages specific to that

protocol

  • Non-TCP protocols exist for other uses (streaming media,

datagrams, etc)

  • An IP connection can specify a port-number
  • Common protocols have “well-known” port numbers

21 (ftp) 25 (smtp) 80 (http) 110 (pop3) 119 (nntp)

  • When a server process starts up, it specifies the port number

it responds to

12/12/2001 (c) 2001, University of Washington 18-16

URLs

  • A Uniform Resource Locator is a naming convention that

uniquely specifies a resource on the web

  • Specifies the protocol
  • Specifies the domain name
  • May specify a specific item in that domain

ftp://ftp.cs.washington/edu/directorynames/filename http://www.washington.edu/computing/index.html

  • Web browsers and other programs that understand URLs

contain client software to handle the appropriate protocols

12/12/2001 (c) 2001, University of Washington 18-17

HTTP

  • One of the most widely used protocols on the web
  • HyperText Transfer Protocol
  • Simple protocol built on top of TCP – uses port 80

telnet www.washington.edu 80 GET /index.html

12/12/2001 (c) 2001, University of Washington 18-18

HTML

  • HyperText Markup Language
  • Simple formatting language that

has text and control codes

  • Browser interprets control codes

when it renders the page

  • One particular kind of control code:

hyperlink that specifies another page

  • n the web by giving its URL
  • Example

<HTML> <HEAD> <TITLE>A Simple Web Page</TITLE> </HEAD> <BODY> <P>Here are some words</P> <P>For more words, see the <A HREF=“www.washington.edu> UW web site</A></P> </BODY> </HTML>

slide-4
SLIDE 4

18-4

12/12/2001 (c) 2001, University of Washington 18-19

Java Applets

  • One of the items that a web page can refer to is a Java

Applet – a compiled Java program that extends Applet or JApplet

  • Applet tag looks something like this

<APPLET CODE=“clock2.class” WIDTH=170 HEIGHT=150 CODEBASE=“http://java.sun.com/Clock” </APPELT>

  • An applet is a normal Java program except
  • It runs in the browser’s window (doesn’t have its own main method)
  • It has security restrictions
  • It can access information from the applet tag and can communicate

with other applets running on the same page

12/12/2001 (c) 2001, University of Washington 18-20

Applet Interface

  • An applet is an class that extends
  • java.applet.Applet (AWT) or
  • javax.swing.JApplet (Swing)
  • Applets should override these methods as needed

init( ) – called when applet is first loaded into the browser; create GUI components here start( ) – called when the applet becomes visible and should do its thing stop( ) – called when applet becomes temporarily invisible (window minimized or applet scrolled out of view, for example) destroy( ) – called when browser unloads the applet

12/12/2001 (c) 2001, University of Washington 18-21

Java Network Programming APIs

  • The java.net library classes make it easy to access the web
  • Class URL – simple interface to download an object given a URL or
  • pen a stream to read or write to a URL
  • Class Socket – supports connections to specific ports on a given

internet host

Uses ordinary Java stream I/O to communicate

  • Other classes to do low-level network programming, etc.
  • If you want to program a web server, one option is Java

servlets or Java server pages

  • Details beyond the scope of CSE143, alas

12/12/2001 (c) 2001, University of Washington 18-22

Summary

  • Key concepts
  • Packet switching & routing
  • Layered protocols

TCP/IP Higher-level protocols (mail, news, web, streaming media, …)

  • Domain names

DNS – map domain names to IP addresses

  • URLs
  • Applets