[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
1 应用层的体系结构
应用层分为三种结构:客户机/服务器结构(c/s)、点对点结构(P2P)、混合结构
1.1 客户机/服务器结构
这种结构的特点就是,客户机给服务器发送请求,然后由服务器发生响应。客户机与客户机之间是不能直接通讯的。
1.2 P2P结构
P2P对比CS结构,其有点是高度可伸缩,缺点是难以管理。
混合式结构结合了P2P和CS结构的优的,比如Napster的文件传输使用P2P结构,文件搜索采用CS结构
2 应用层进程间通信
2.1 Socket
同一主机中进程的通信是依靠操作系统提供的,而不同主机间进程通信需要依靠套接字Socket。Socket可以理解为一种API。进程通过Socket编程,来对协议进行选择,参数进行设置。
一般来说,同一台主机上的进程会通过PCB进程控制块(Process Control Block,
PCB)进行唯一标识。但是在网络通信中,怎么通过一台主机将信息发送到另一台主机的指定进程上呢?一般采用端口号。
IP地址+端口号,就唯一定义了网络上所有进程中的那一个。
2.2 应用层协议
一般来说,网络应用需要遵循应用层协议
3 网络应用的需求与传输层服务
Internet提供了两种传输服务:TCP服务,UDP服务