Você está na página 1de 9

ECE 3700 Chapter 2 Notes from Book

Section 1: Principles of Network Applications


These are programs that run over the internet, or some network.
Not just software, hardware considerations as well
You need a plan first. Application architecture: How the application
is structured over various end systems
Two prominent designs: Peer to Peer (P2P) or Client server
In client server, there is always an on host (server) which services requests
from other hosts known as clients
Example: Web server that accepts clients from browsers running on client hosts
Note in client server clients do not directly communicate with each other.
Server has a well known address (IP Address), a client can send
a packet to the server's IP addres.
Web, FTP, Telnet and email applications
Sometimes, a single server is not able to keep up with all requests
from the clients.
Multiple data centers for Google, Yahoo and Amazon use multiple data centers.
In P2P architecture, there is minimal to no reliance on dedicated servers in dat
a centers
Peers communicate with each other, not via a data center.
File sharing (BitTorrent) , Skype use P2P
Process Communication
A process is a program that runs on an end system
They exchange messages across a computer network
Process that initiates communication is the client. The process
that waits to be contacted before the session starts is the server.
Client Server Programming: A software Interface
A process sends messages into and gets messages out of a software interface know
n
as a socket. A socket is the API because it is the connection between
Addressing the Processes:
On the internet, the host is identified by its IP address. Its a 32 bit quantity
that identifies the host
A destination port number serves this purpose.
Transport Services Available to the Applications:

Reliable data Transfer: We want to provide reliable data transfer. When this isn
't provided we
classify these as loss-tolerant applications such as multimedia photos/video/aud
io.
Throughput:
We define throughput in Chapter 1 as the minimum rate in which the data is deliv
ered.
When bandwidth is factor, we call these applications bandwidth-sensitive applica
tions.
Security: Transport protocol can sometimes encrypt the data for security service
s.
TCP Services:
The TCP service model is to include a connection oriented service an a reliable
data transfer service. When an application
invokes TCP as its transport protocol, the application receives both from TCP:
Connection oriented service. The TCP client and server exchange transport layer
control information with each other before the application
level messages begin to flow. This is called handshaking. After handshaking, a T
CP connection exists between the sockets
of the two processes. The connection is full duplex in which two processes can s
end messages to each other at the exact same time.
After sending messages, it must destroy the connection.
Reliable data transfer service: The communicating processes can rely on TCP to d
eliver all data sent without error
and in order. When one side of the application passes a stream of bytes into a s
ocket, it can count on TCP to deliver
the same stream of bytes to the receiving socket. No missing or duplicate bytes.
UDP services:
UDP is a no frills lightweight transport protocol. Minimal services. No handshak
ing exits here
Services that are not provided by Transport Protocols:
TCP provides reliable end-end datatransfer. Can be enhanced at the application l
ayer with SSL for security
Application Layer Protocols:
The types of messages exchanged.
The syntax of various message types
Semantics of the field, i.e. the meaning of the information
Rules for determining when and how a process sends messages and responds.

Section 2: HTTP
Heart of the internet. Client and Server program on different end systems
They communicate using HTTP protocol.

Web page: Consists of objects, usually a HTML file as the base object, and other
files.
References the URLs. URL: http://www.aaa.edu/something/picture1.jpg
Web browsers: Safari, Internet Explorer, Firefox implement the client side. Thus
we use browser and client interchangeably
Web servers: Implement the server side of HTTP
HTTP uses TCP as the underlying transport layer. Client first intitates a TCP co
nnection request
with the server.
Client sends HTTP messages into the socket interface and receivesHTTP response m
essages from its socket interface.
HTTP server receives request messages from the socket interface and sends respon
se messages into its socket interface. Once the client sneds a message into the
interface, in
the hands of TCP. TCP does provide a reliable data transfer service to HTTP. Imp
lies that each HTTP request message
will eventually arrive at the server.
HTTP will not lose data in transfer.
2.2.1: Non persistent and Persistant Connections
In many applications, the client and server communicate for a long time, with th
e client
requesting a lot of stuff and the server responding to every request.
When client-server interaction is taking place over TCP, should the developer se
nd
each request/response over TCP one connection or several?
If we use non persistant connections, this means its done in one TCP connection.
If we use persistant connections, then that means we have a seperate TCP connect
ion
for each request/response.
Non persistant connections
Lets suppose we want to load up a website. www.somename.com
This contains a base HTML file and 10 JPEG objects.
This is what happens:
1. HTTP client initiates a connection to the server on port 80, which is the def
ault port number for HTTP.
Of course, there will be a TCP socket for the client and server.
2. The client sends a HTTP request message via the socket.
3. HTTP server processes the request message, retrieves the object, encapsulates
the object in
HTTP response message and sends the message to the client (via the socket).

4. HTTP server process tells TCP to close the TCP connection. TCP will not termi
nate until it
knows the client receives the message.
5. HTTP client receives the response message. TCP connection terminates. The obj
ects are loaded.
6. Repeat 1-4 for all objects.
This is non-persistant connections. The connection does not persist for each obj
ect
When a user wants to request a web page, 11 TCP connections are generated, assum
ing that the
web page has 10 objects.
Definition:
Round trip time (RTT) the time it takes for a small packet to travel from client
to server, and hten
back to the client. RTT includes packet-propogation delays, packet queing delays
. See the following
space time diagram
| \
|
| \
|
| \ |
|
\ |
|
\ |
|
\|
|
/ |
|
/ |
| / |
| /
|
| /
|
urs
| \
|
| \
|
| \ |
|
\ |
|
\ |
|
|
|
|
|
|
|
/|
|
/ |
|
/ |
| / |
| /
|
| /
|
RTT.

Initiate TCP connection

Total time = Round Trip Time. At this point the Request for a file occ

Time to process the file

Entire file received. From the Request for file and this point is the

What happens when a user clicks on a hyperlink?


There is a "three way handshake" the client sends a small TCP segment to the ser
ver, the server acknowledges and responds
with a three way handshake. Client sends a small TCP segment and the client ackn
owledges back to the server. Then client sends the handshake

with the acknowledgement, completing the third part.

Persistant HTTP connection


Non persistent connections have some shortcomings. First brand new connection mu
st be established and mainined fo rEACH OBJECT.
For
ust
the
may

each of these connections, TCP buffers must be allocated and TCP variables m
be kept in both
client and server. Can place a significatn burden on the web server, which
be serving requests from thousands of different clietns simultaneosuly.

Subsequent requests between the same client and server can be sent over a single
TCP connection.
Multiple web pages residing on the same server can be sent from the server to th
e same client over a single persistent TCP connection.
These requests can be made back to back without waiting for replies to pending r
equests.
HTTP server closs a connection when it isn[t used for a certain time (timeout in
terval).
Remarks: The HTTP response time: one RTT to inittate TCP connection
one RTT for HTTP request and first few bytes of HTTP response to return
non persistant HTTP response time = 2RTT + file transmission time
2.2.3 HTTP Message Format
The HTTP request Message
GET /somedir/page.html HTTP/1.1
First line of HTTP request message is called the requst line. The subsequent lin
es are called the header lines.
The request line has three files, the method field, the URL and the HTTP version
field.
The entire body is empty with the GET method, but is used with the POST method.
HTTP response Message
200 OK: Wish granted
301: Moved Permanantly
400: Bad Request
404: Not found
505: HTTP version not supported
2.2.4: User-Server Interaction: Cookies
Consists of: name of server, Identification sumer

Web Caching
Web cache: A proxy server entity that satisfies HTTP requests on the bealh of an
origin Web server.
It has its own disk storage and keeps coopies of recently requested objects in t
his storage.
As shown, a user's browser can be configured so that all of the user's HTTP requ
ests are first directed to the cache.
Once a browser is configured, each browser's request for an object is first dire
cted to the web cache.
Intensity = Request Rate * Speed
2.3 FTP (File Transfer Protocol)
In an FTP session, user is sitting in from of the local host, and wants to perfo
rm a
transaction of files to a remote host.
First provides username and password,. The user then requests to get or transfer
fils.
Differences between HTTP and FTP:
FTP uses two parallel connections to transfer a file, a control connection and a
data connection.
The control connection is used to send
control information between the two hosts.
Information such as user id, password and commands to "put and "get files
Data connection is used to send a file.

2.4 Email
One of the most important applications on the net.
Three major components: User angents, Mail servers and SMTP (Simple Mail Transfe
r Protocol)
Suppose Alice wants to send a message to Bob.
Bob's mailbos manages and maintains the messages that have been sent to him. .
When Bob wants to access the messages in his mailbox, the mail server containing
his mailabox authenticates BOB. Alice's mail server must
deal with the failures in Bob's mail server.
If Alice's server cannot deliver the Mail to Bob's mailbox, then the message is
held

in a message queue.
SMTP is a common protocol for email.
Relies on TCP. to transfer the mail from the sender to the recipients mail serv
er.
SMTP has a client side and a server side. Both client and server of SMTP run on
every server.
When SMTP sends a message, it is a clientn, when it receives messages it acts a
SMTP server.
SMTP uses persistent connection.
Three phases: Authorization (user name and password),
Transaction (receives email)
Quit command, user quits (mail service deletes all messages that were marked for
deletion).

Mail access protocols


Two big ones: POP3 and IMAP
POP3 uses download and delete mode.
Three phases: Authorization (user name and password),
Transaction (receives email)
Quit command, user quits (mail service deletes all messages that were marked for
deletion).
Messages cannot be read if change of client occurs
IMAP. Keeps all messages in one place at the server level.
2.5 Domain Name Server (DNS)
Server sometimes defined by its name (Yahoo Server, Google server, etc..)
These hosts are defined by their IP addresses.
Getting the IP address from the domain name:
Same user machine runs the client side of the DNS application
Browser extracts the hostname www.google.com, passes host name to client side of
DNS application
DNS client sends a query to the hostname
Gets the IP address in the response.
Hostname to IP address conversion:
Host aliasing. This is where one DNS server goes by two or more names.
The canonical hostname happens to be the longest hostname (full hostname)
Mail Server aliasing: Bob@hotmail.com vs Bob@washington-mountainwest-hotmail.com

Local Distribution:
There exist replicated DNS servers. Its up to the DNS server to balance the load
amoung many
Table of IP addresses and the DNS server tells the client which one to go to.
2.5.2: How does DNS work?
Typically one DNS server that contains all the mappings. However, this centraliz
ed design
approach is bad because of maintenance, single point of failure, traffic volume
and
Distant centralized database.
Hierarachal approach
DNS uses a hierarchy that are distributed amoung the planet.
No DNS server has all mappings for the hosts in the internet.
Many classes of DNS servers (root) (top level) DNS servers and authority DNS ser
ver.
The client forst contacts one of the root servers which returns the IP addresses
for the TLD server fr the top level domain.
TLD authoritative servers
Top level domain (TLD servers)
responsible for com, org, net edu aero jobs, museums and all top level country d
omains
.edu .fra .au etc etc.
Important type of DNS server called the local DNS server.Does not belong to the
hierarchy of servers, but is central to the
DNS architecture.
DNS name resolution:
Iterated query. Passing the buck to the next server.
Server A: I don't know ask server B
Server B: I don't know... ask server N
DNS caching: Very important for DNS systems.
In a query chain when a DNS server receives a DNS reply (a mapping for instance)
it can
cache the mapping in its local memory.
Each time the local DNS server dns.umanitoba.edu
receives a reply from some DNS server, it can cache any of the information in th
e reply.
DNS Records and messages 2.5.3

Resource record is a four tuple that contains the following fields


(Name, value, type TTL). TTL: Time to live When should this thing be destryed.
Type: If type = A then name is hostname. Value = address
If type = NS: Name is domain. Value is authoritative name.
If CNAME: Then Canonical Name
IF MX: Then Mail server
DNS Messages:
Identification Flags
Question Number Answer RRS
Authority RRS
Questions
Answers
Authority
Additional Infromation
P2P Applications
Server transmission must sequentially send N file copies.
Time for 1 copy.
F / us
N copies N F / us
Client dmin: Min download rate.
D >= max(NF/us, F/dmin)
BitTorrrent File Distribution:
Fiel divided into chunks, and people receives the torrents
in chunks.
Torrent: Group of peers exchanging chunks
While downloading, peer uploads chunks to other peers
Peer may change peers with whom it exchanges chunks.
Churn: People may come and go
End of chapter

Você também pode gostar