Lecture 4
Lecture 4
Lecture 4
OSI
TCP/IP
MODEL
APPLICATION
7 APPLICATION
TRANSPORT
TRANSPORT
4 Tranmission Control Protocol (TCP)
User Datagram Protocol (UDP)
INTERNETWORKING
NETWORK
3 Internet Protocol (IP)
Internet Control Message Protocol (ICMP)
NETWORK INTERFACE
DATA LINK
&
2
HARDWARE
CONNECTIONS
PHYSICAL
LAN: Ethernet, Token Ring, FDDI, ATM...
1
WAN: SLIP/PPP, X.25, Frame Relay...
P2
1
Chapter 2
Application Layer
Chapter 2: outline
2.1 principles of network 2.6 P2P applications
applications 2.7 socket programming
2.2 Web and HTTP with UDP and TCP
2.3 FTP
2.4 electronic mail
SMTP, POP3, IMAP
2.5 DNS
2
Chapter 2: application layer
our goals: learn about protocols by
conceptual, examining popular
implementation aspects application-level
of network application protocols
protocols HTTP
transport-layer FTP
service models SMTP / POP3 / IMAP
client-server DNS
paradigm creating network
peer-to-peer applications
paradigm socket API
3
Creating a network app application
transport
network
data link
Application architectures
possible structure of applications:
client-server
peer-to-peer (P2P)
4
Client-server architecture
server:
always-on host
permanent IP address
data centers for scaling
clients:
communicate with server
client/server may be intermittently
connected
may have dynamic IP
addresses
do not communicate directly
with each other
P2P architecture
no always-on server peer-peer
arbitrary end systems
directly communicate
peers request service from
other peers, provide service
in return to other peers
self scalability – new
peers bring new service
capacity, as well as new
service demands
peers are intermittently
connected and change IP
addresses
complex management
5
Processes communicating
process: program running clients, servers
within a host client process: process that
within same host, two initiates communication
processes communicate server process: process that
using inter-process waits to be contacted
communication (defined by
OS)
processes in different hosts
communicate by exchanging aside: applications with P2P
messages architectures have client
processes & server
processes
Sockets
process sends/receives messages to/from its socket
socket analogous to door
sending process shoves message out door
sending process relies on transport infrastructure on
other side of door to deliver message to socket at
receiving process
application application
socket controlled by
process process app developer
transport transport
network network controlled
link by OS
link Internet
physical physical
6
Addressing processes
to receive messages, identifier includes both IP
process must have identifier address and port numbers
host device has unique 32- associated with process on
bit IP address host.
Q: does IP address of host example port numbers:
on which process runs HTTP server: 80
suffice for identifying the mail server: 25
process? to send HTTP message to
A: no, many processes gaia.cs.umass.edu web
can be running on same server:
host IP address: 128.119.245.12
port number: 80
more shortly…
7
What transport service does an app need?
data integrity throughput
some apps (e.g., file transfer, some apps (e.g.,
web transactions) require multimedia) require
100% reliable data transfer minimum amount of
other apps (e.g., audio) can
throughput to be
tolerate some loss “effective”
other apps (“elastic apps”)
8
Internet transport protocols services
application underlying
application layer protocol transport protocol
9
Securing TCP
Chapter 2: outline
2.1 principles of network 2.6 P2P applications
applications 2.7 socket programming
app architectures with UDP and TCP
app requirements
2.2 Web and HTTP
2.3 FTP
2.4 electronic mail
SMTP, POP3, IMAP
2.5 DNS
10
Web and HTTP
First, a review…
web page consists of objects
object can be HTML file, JPEG image, Java applet,
audio file,…
web page consists of base HTML-file which
includes several referenced objects
each object is addressable by a URL, e.g.,
www.someschool.edu/someDept/pic.gif
HTTP overview
HTTP: hypertext
transfer protocol
Web’s application layer
protocol PC running
client/server model Firefox browser
11
HTTP overview (continued)
uses TCP: HTTP is “stateless”
client initiates TCP server maintains no
connection (creates information about
socket) to server, port 80 past client requests
server accepts TCP
connection from client aside
protocols that maintain
HTTP messages “state” are complex!
(application-layer protocol
past history (state) must be
messages) exchanged maintained
between browser (HTTP if server/client crashes, their
client) and Web server views of “state” may be
(HTTP server) inconsistent, must be
TCP connection closed reconciled
HTTP connections
non-persistent HTTP persistent HTTP
at most one object multiple objects can
sent over TCP be sent over single
connection TCP connection
connection then between client, server
closed
downloading multiple
objects required
multiple connections
12
Non-persistent HTTP
suppose user enters URL: (contains text,
www.someSchool.edu/someDepartment/home.index references to 10
jpeg images)
1a. HTTP client initiates TCP
connection to HTTP server
(process) at 1b. HTTP server at host
www.someSchool.edu on port www.someSchool.edu waiting
80 for TCP connection at port 80.
“accepts” connection, notifying
2. HTTP client sends HTTP request client
message (containing URL) into
TCP connection socket. 3. HTTP server receives request
Message indicates that client message, forms response
wants object message containing requested
someDepartment/home.index object, and sends message into
its socket
time
Application Layer 2-25
time
6. Steps 1-5 repeated for each of
10 jpeg objects
13
Non-persistent HTTP: response time
connection RTT
Persistent HTTP
14
HTTP request message
~
~ entity body ~
~ body
15
Uploading form input
POST method:
web page often includes
form input
input is uploaded to
server in entity body
URL method:
uses GET method
input is uploaded in URL
field of request line:
www.somesite.com/animalsearch?monkeys&banana
Method types
HTTP/1.0: HTTP/1.1:
GET GET, POST, HEAD
POST PUT
HEAD uploads file in entity
asks server to leave body to path specified
requested object out in URL field
of response DELETE
deletes file specified in
the URL field
16
HTTP response message
status line
(protocol
status code HTTP/1.1 200 OK\r\n
status phrase) Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n
Server: Apache/2.0.52 (CentOS)\r\n
Last-Modified: Tue, 30 Oct 2007 17:00:02
GMT\r\n
header ETag: "17dc6-a5c-bf716880"\r\n
Accept-Ranges: bytes\r\n
lines Content-Length: 2652\r\n
Keep-Alive: timeout=10, max=100\r\n
Connection: Keep-Alive\r\n
Content-Type: text/html; charset=ISO-8859-
1\r\n
\r\n
data, e.g., data data data data data ...
requested
HTML file
Application Layer 2-33
17
Trying out HTTP (client side) for yourself
1. Telnet to your favorite Web server:
18