Slide 2 - Application Flashcards
Internet Protocol Stack
- Application
- Transport
- Network
- Link
- Physical
How many addresses has an IPV4 address ?
It has 32 bits and so 2^32 = 4294967296
What is needed to send or receive a message ?
An IP address (IPV4 or IPV6) and a port number
What does the Application Layer demands from the Transport Layer Services ?
- Data integrity;
- Throughput (some apps, e.g. multimedia, require a minimum amount of Throughput to be “effective”);
- Security;
- Timing;
Characteristics of the TCP service:
- Connection-oriented: setup required;
- Reliable transport between the sending and receiving process;
- Flow control: the sender won’t overwhelm the receiver;
- Congestion control: control transmission speed when network overloaded;
DOES NOT PROVIDE:
- Timing, minimum throughput or security.
Security in TCP
Vanilla TCP (& UDP) just send the cleartext passwords through the internet. The TLS (Transport Layer Security) is needed providing encryption, data integrity and end-point authentication.
If implemented in application layer, the apps use TLS libraries.
Client-Server Architecture
Server:
- Always-on host;
Client:
- Uses the IP address and port number to communicate.
- May be intermittently connected;
- Do not communicate directly with each other.
What does TCP provide ?
TCP provides a reliable, in-order transfer of bytes (“pipe”) between client and server.
What does UDP provide ?
UDP provides unreliable transfer of groups of bytes (“datagrams”) between client and server.
Characteristics of TCP:
- read() and write();
- Byte stream (and no byte is lost);
- Bytes read with read() may correspond to several write();
- Bytes written with write() may need to be read with several read();
Characteristics of UDP:
- sendto() and recvfrom();
- Preserves boundary between messages.
- Each message read with recvfrom() corresponds to a single one sendto();
- A message may be lost.
HTTP Overview
- HTTP is “stateless”, so the server maintains no information about past client requests.
- Uses TCP, by default using port 80.
What is a Web Page?
A Web page consists of objects:
- HTML file;
- JPEG images;
- Audio files, …
It has a base object ( HTML file), in which it may reference the other objects.
Each object is addressable by a URL (Uniform Resource Locator).
Types of HTTP connections
- Non-persistent HTTP or HTTP/1.0.
- Persistent HTTP or HTTP/1.1.
What is the Non-persistent HTTP ?
Non-Persistent HTTP or HTTP/1.0 can :
- At most one object is sent over a TCP connection;
- Browsers can open parallel connections (typically 5-10).
What is Persistent HTTP ?
Persistent HTTP or HTTP/1.1. can :
- Multiple objects can be sent over a single TCP connection;
- When using pipelining a browser can send requests as soon as it identifies them.
What is the response time in Non-persistent HTTP ?
RTT (round trip time):
- time for a small packet to travel from client to server and back.
Response time:
- One RTT to initiate TCP connection;
- One RTT for HTTP request and first few bytes of HTTP response to return;
- File transmission time.
Total = 2 X RTT + transmission time.
What are the issues of Non-persistent HTTP ?
- Requires 2 RTTs per object;
- OS overhead for each TCP connection (e.g. allocate buffers and variables);
- Browsers often open parallel TCP connections to fetch referenced objects.
What is the response time in Persistent HTTP ?
- Server leaves the connection open after sending response;
- Subsequent HTTP messages between same client/server are sent over the open connection (requiring 1 RTT per each object after the first);
- With PIPELINING: client sends requests as soon as it encounters a referenced object - as little as ONE RTT for all referenced objects.
HTTP request message:
- Uses ASCII (human-readable format)
[request line] (GET, POST, HEAD)
GET /somedir/page.html HTTP/1.1
——————————————-
[header]
Host: www.someschool.edu
User-agent: Mozilla/4.0
Connection: close
Accept-language: fr
——————————————-
[message body]
HTTP Response Message
[status line]
НТTP/1.1 200 OK
——————————————-
[header]
Connection close
Date: Thu, 08 Aug 2019 12:00:15 GMT
Server: Apache/1.3.0 (Unix)
Last-Modified: Mon, 24 Jun 2019 ……
Content-Length: 6821
Content-Type: text/html
——————————————-
data data data data data …
HTTP Response: Status Line Codes
200 - OK
301 - Moved Permanently
304 - Not Modified
400 - Bad Request [Req. not understood by the server]
404 - Not Found
505 - HTTP Version Not Supported
What’s the goal of the Conditional GET
Its goal its not to send objects if the cache already has a up-to-date version.
Client: specify date of cached copy in HTTP request header:
If-modified-since: <date>
Server: response contains no object if cached copy is up-to-date:
HTTP/1.0 304 Not Modified</date>
What is the purpose of cookies ?
Cookies are useful to maintain some state between transactions. When visiting a site for the first time the server will give the client a cookie number identifying him for future requests.
Cookies permit sites to learn a lot about you, it may supply your name and email to sites.