c1 basic network concepts - The Layers of a Network

开始看《java network programing》written by Elliotte Rusty Harold.

Tcp/Ip协议从上到下有4层:application layer,transport layer(Tcp,Udp), Internet layer(IP), the host-to-network layer(wifi,ethernet,lte)。(坑:用个什么画图工具形象地画个图呢?)


The Host-to-Network layer

该层是java程序看不到的地方,被hidden的,即常说的link layer,data link layer,network interface layer,这一层的一部分由连接电脑的物理设备组成,像网线,光纤,无线波等。

java程序员基本上需要考虑该层,如果要考虑,那也是考虑“效果(Performance)”。比如,你的程序基于的网络是稳定高速的光纤还是高时延的卫星通信,还是收费高的移动网络,基于这些差异,你可能要做出一些选择。但,不管你的程序遇到的是哪种网络,但你使用的访问网络的api是一样。


The Internet Layer

This layer defines how bits and bytes of data are organized into the larger groups called packets, and the addressing scheme by which different machines find one another. 

最常用的网络层协议是IP协议。

IP协议有2种,32位的IPv4,128位的IPv6。

In both IPv4 and IPv6, data is sent across the internet layer in packets called datagrams. 

每个IPv4数据报都包含一个20-60字节头和有效负荷能达到65,515个字节的数据,但实际上IPv4数据报都很小。而IPv6不管头还是有效负荷都大得多。

除了路由和寻址,Internet Layer还负责不同类型host-to-network间的通信,如果没有该层,那2台计算机间要通信那只能必须是相同类型的网络类型了。


The Transport Layer

原始的数据报有个缺点是不能保证一定被投递,即使都投递到了也没法保证数据不被corrupted,即使没有被corrupted,也不能保证收到的顺序和发送的顺序一致!

传输层正是来解决上述问题的,它的功能是保证按顺序收数据(收到数据的顺序和发送时的一样),并且保证不丢包,不被损害。如果有丢包发送,会要求Internet Layer重发一次,IP协议在每一个datagrame中添加了包含更多信息的header。

2种主要协议:

TCP:Transmission Control Protocal,保证对丢失或者损坏的数据重发,保证按发送顺序传递数据,常被称为“可靠的”的协议

UDP:User Datagrame Protocol,容许接受者检查数据是否被损害(丢包,损害会重发吗?),不保证按发送顺序传输数据。比TCP快,“不可靠的”


The Application Layer

The layer that delivers data to the user is called the application layer. The three lower layers all work together to define how data is transferred from one computer to another.The application layer decides what to do with the data after it’s transferred. 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值