[Network]Application Layer
1 Principles of Network Applications
1.1 Application Architectures
Client-Server
Peer-to-Peer
Hybird of C/S and P2P
--Skypeclient-server: find the address of the remote clientclient-client: direct communication--Instant messagingSimilar with Skype
1.2 Application Requirements(From Transport Layer Services)
1. About Data Loss2. Timing3. Throughput4. 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.
Response time: 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 is stateless, so if we want to keep states of users, we must utilize the process of HTTP to get it.
Most of 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 cookies 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: 是控制和数据分离,当有紧急情况(控制数据须要传输时,控制传输具有较高的优先级)1) client build control connection, server build data connection2) FTP is stateful
2.3 Email
1. SMTP: reliably transfer email messages(TCP connection)
Compare with HTTPHTTP: pull(GET); No such restriction;
each object encapsulated in its own response msgSMTP: push(transfer); 7-bit ASCII;
multiple objects sent in multiple msgMessage Format: 7-bit ASCIIheader lines (if extention, add some lines to declare the file type)body2. POP3
Store email locally.3. IMAP
Store on mail server.
4. The difference of them
This part I most quoted from the page.SMTP is the basis. POP3(locally, stateless) and IMAP(on the server, stateful-folder) are used to access the mails.
2.4 DNS
TLD: Top-Level-Domain com, cn, org ...
1. DNS records
hostname is the name of a host - ibmdomain is part of URL you can consider as. - ibm.comalias name is URL - www.ibm.comcanonical name is real name - servereast.backup2.ibm.com2. DNS Protocol, Message
query and reply messagesheader: identification and flagssome fields3. 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 P2P
There are some properties of P2P:1) no always-on server2) end systems directly communicate3) peers change IP
1. File Distribution
C/S is "N copies upload and N copies download", but P2P is "One copy uploads and N copies download".
BitTorrenttracker: track peers participating in torrent. - an individualtorrent: group of peers exchanging chunks of a file. - a groupThe processes of bit torrent consist of pulling chunks and sending chunks.- When downloading chunks, the peer will request a list of chunks from its neighbors, and choose the rarest chunks first. (从最稀缺的内容開始)- When uploading chunks, the peer will send chunks to four neighbors currently sending it chunks at highest rate.(投桃报李)So one file will be held by several peers in the network and each peer can both download and upload. And there are some prescriptions for peers to down and up.2. Searching for Information
Query bloodis a method to find resource in a P2P network. Because the graph of P2P network may not be connected by each node. So a query must be 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.
最新文章
- Java_生产者消费者模式
- JavaScript 常用小代码
- 浅谈设计模式在GIS中的应用
- SymPy-符号运算好帮手
- struts2 convention-plugin
- POJ 3624 Charm Bracelet 背包问题的解决方案
- WPF开发的FTP文件上传工具
- Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLIC
- python进阶(5):组合,继承
- sql server实现简繁转换
- git学习手记(也许仅对本人有用)
- lwip TCP client &; FreeRTOS 打开TCP 的 保活机制 LWIP_TCP_KEEPALIVE==1
- 【十二】jvm 性能调优工具之 jhat (JVM Heap Analysis Tool)
- Oracle 10g使用amdu抽取数据文件
- 使用wget命令爬取整站
- 我的MQ笔记
- vagrant特性——基于docker开发环境(docker和vagrant的结合)-3-boxes和配置
- mysql 查询时间戳(TIMESTAMP)转成常用可读时间格式
- Containerpilot 配置文件 之 Jobs
- Python递归 — — 二分查找、斐波那契数列、三级菜单
热门文章
- AllocateHWnd的作用,以及它在控件里的使用
- Cocos2d-x layout (二)
- Android:通知栏的使用
- 《Head First 设计模式》学习笔记——模板方法模式
- (2)入门指南——(7)添加jquery代码(Adding our jQuery code)
- C# split字符串 依据1个或多个空格
- 24位和8位BMP图片保存纯C代码
- birt报表报错, There is no report design object available.org.eclipse.birt.report.exception.ViewerExcepti
- 最终结算“Git Windowsclient保存username与password”问题
- 从零開始制作H5应用(4)——V4.0,增加文字并给文字加特效