[Network] Application Layer

Source: Internet
Author: User
Tags imap

1 Principles of Network applications
1.1 Application Architectures
Client-server
Peer-to-peer
Hybird of C/s and peer
--skype
Client-server:find the address of the remote client
Client-client:direct communication
--instant messaging

similar with Skype


1.2 Application Requirements (from Transport Layer Services)
1. About Data Loss
2. Timing
3. Throughput
4. Security


2 Application-layer Protocols
2.1 Web and HTTP

1. Properties of HTTP

Uses TCP

Nonpersistent Http:one TCP Connection for one object transmission

RTT: Time for a small packet from client to server and back.

ResponseTime: RTT (TCP connection) + RTT (HTTP request) + file transmission

Persistent Http:multiple Objects on one TCP connection

HTTP is stateless:

Server maintains no information about past client requests.


2. HTTP Request messages:

Request Line:method Path Protocol

Header lines

Entity body


3. HTTP Response messages:

Status Line:protocol statuscode statusphrase

Header lines

Data


4. Cookies

As we have disscussed above, HTTP was stateless, so if we want to keep States of users, we must utilize the process of HTTP To get it.

Most of the Web Sites use cookies.

Four components:

1) Cookie header line in HTTP request message

2) Cookie header line in HTTP response message

3) cookie file kept on user's host, managed by user browser

4) Cookie file kept on server database of WEB sites

To sum up, HTTP is stateless for it does not store the information of user states. But we can store the cookie in user hosts and servers and let the HTTP messages carry states.


5. Web Cache

Why caching

1) Reduce response time

2) Reduce traffic

With HTTP:

Use conditional get:if-modified-since, not-modified


2.2 FTP
FTP seperate control and data connections, see following:
Out-of-band: Is the control and separation when there is an emergency (control data needs to be transmitted. Control transfer has a higher priority)
1) Client build control connection, server build data connection
2) FTP is stateful


2.3 Email
1. SMTP: Reliably transfer email messages (TCP connection)
 
Compare with HTTP
Http:pull (GET); No such restriction; Each object encapsulated with its own response msg
Smtp:push (transfer); 7-bit ASCII; Multiple objects sent in multiple msg
Message format:7-bit ASCII
Header lines (if extention, add some lines to declare the file type)
Body
2. POP3
Store email locally.
3. IMAP
Store on mail server.

4. The difference of them
This is the page from the
quoted.
SMTP is the basis. POP3 (locally, stateless) and IMAP (on the server, Stateful-folder) is used to access the mails.

2.4 DNS

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvc2l5dw1hdg8=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">tld:top-level-domain com, cn, org ...

1. DNS Records
hostname is the name of a HOST-IBM
Domain is part of the
URL you can consider as.-IBM.com
alias name is url-www.ibm.com
canonical name is real name-servereast.backup2.ibm.com
2. DNS Protocol, Message
Query and Reply messages
Header:identification and Flags
some
fields
3. An example:inserting records into DNS

(Networkutopia.com,dns1.networkutopia.com, NS)

(dns1.networkutopia.com,212.212.212.1, A)

Then
others can find your Web site at IP 212.212.212.1

2.5 Peer
There is some properties of peer:
1) No always-on server
2) End systems directly communicate
3) Peers change IP

1. File Distribution

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvc2l5dw1hdg8=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">

c/S is "n copies upload and n copies download", but peer is "one copy uploads and n copies download".

BitTorrent
Tracker:track peers participating in torrent. -An individual
Torrent:group of peers exchanging chunks of a file.-A group
The
processes of bit torrent consist of pulling chunks and sending chunks.
-When downloading chunks, the peer would request a list of chunks from its neighbors, and choose the rarest chunks F Irst. (start with the most scarce content)
-When uploading chunks, the peer would send chunks to four neighbors currently sending it chunks at highest RA Te. (reciprocate)
So one file is held by several peers in the network and each
peer can both download and upload. And there is some prescriptions for peers, and up.
2. Searching for information
Query Blood
Is
a method to find resource in a peer network. Because the graph of the peer network may is connected by each node. So a query must is broadcasted in the network to find a resource.
It may cause DoS attack.
The
TCP connection built in the process of blooding form a hierarchical searching graph.
3. Skype
almost similar with BitTorrent and Query blood.





End.


[Network] Application Layer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.