在前面的讨论和介绍中,我们知道要做网络方面的应用开发,必须了解网络的体系,极其相关的知识。特别是对协议部分的理解,对理论的理解,为我们后期的应用开发提供非常有力的支持,来指导我们。
对网络部分的学习和理解,前面几部分会做独立的介绍,在有一定的理解认识后,然后和实际的开发示例结合起来,帮助我们更快的了解。深入体会协议部分。特别是对Data Linker Layer,Network Layer,Transposrt Layer 极其以上的应用,表示层。
网络里边需要了解的非常多,我们只了解开发需要使用到的部分,有兴趣的朋友可以参考相关文档。对这么庞大的网络系统,不同网络之间互通信息,我们是怎么实现的。常用的局域网(LAN)技术,广域网(WAN)技术。都需要我们有个比较深刻的认识。个人感觉首先了解LAN技术特别重要,对于我们要开发的网络应用是一个特别重要的理论指导。有一些基础后,在了解WAN。恩,好拉,让我们慢慢的一起讨论吧。
让我们从OSI,TCP/IP来对网络进行了解吧。
通过以上Figure 1-1,我们可以看出各层应用及其协议的分布位置工作于那层。
接下来,会对各层作用做个简单的描述。
Defining the Layers
Because almost all protocols are based on the OSI model, it is important to
completely understand how the model operates, and to understand the protocols,
you must first understand the framework. The following sections explain
the seven layers in more detail, and Figure 1-1 gives examples of protocols that
reside at each layer.
Layer 1: Physical Layer
The simplest definition of the physical layer is that it deals with how binary
data is translated into signals and transmitted across the communications
medium. (I talk more about media in the “Detailed Layer Analysis” section
later in this chapter.) The physical layer also comprises the functions and procedures
that are responsible for the transmission of bits. Examples would be
procedures such as RS-232 handshaking or zero substitution functions on
B8ZS T1 circuits. The physical layer concerns itself only with sending a stream
of bits between two devices over a network.
Layer 2: Data Link Layer
Layer 2, the data link layer, handles the functions and procedures necessary for
coordinating frames between devices. At the data link layer, zeros and ones are
logically grouped into frames with a defined beginning and end. Unlike the
physical layer, the data link layer contains a measure of intelligence. Ethernet, a
common Layer 2 protocol, contains detection algorithms for controlling collision
detection, corrupted frames, and address recognition. Higher layers depend on
the data link layer not only to provide an error-free path but also to detect errors
that may occur. Corrupted data should never be passed to upper layers.
Layer 3: Network Layer
Layer 3 is the end-to-end communications provider. Whereas the data link
layer’s responsibility ends at the next Layer 2 device, the network layer is
responsible for routing data from the source to the destination over multiple
Layer 2 paths. Applications utilizing a Layer 3 protocol do not need to know
the details of the underlying Layer 2 network. Layer 3 networks, such as those
using the Internet Protocol, will span many different Layer 2 technologies such
as Ethernet, Token Ring, Frame Relay, and Asynchronous Transfer Mode
(ATM). Some examples of Layer 3 protocols are IP, IPX, and AppleTalk Datagram
Delivery Protocol (DDP). Although the network layer is responsible for
the addressing and routing of data from source to destination, it is not responsible
for guaranteeing its delivery.
Layer 4: Transport Layer
Networks are not reliable. On Ethernet networks, collisions can occur resulting
in data loss, switches can drop packets due to congestion, and networks themselves
can lose data due to overloaded links (the Internet itself experiences
anomalies such as these on a daily basis). Protocols that operate in the transport
layer may retransmit lost data, perform flow control between end systems, and
many times add an extra layer of error protection to application data. While the
network layer delivers data between two endpoints, the transport layer can
guarantee that it gets to its destination.
Layer 5: Session Layer
The session layer provides the ability to further control communications
between end systems by providing another layer of abstraction between transport
protocols and the application. If an application layer protocol possesses
this functionality, a session layer protocol may not be needed. NetBIOS, as you
will see later in this chapter, is a perfect example of a session layer protocol.
Sometimes the session layer does not reveal itself as a protocol, but rather as a
procedure performed to allow a protocol to continue its functions. Even
though a protocol will exist at a certain layer, a procedure of that protocol can
sometimes perform functions that normally reside in another layer. I will note
instances in later chapters where this anomaly takes place.
Layer 6: Presentation Layer
The presentation layer is another layer that sometimes does not manifest itself
in obvious ways. The presentation layer handles making sure that data formats
used by application layer protocols are compatible between end systems.
Some examples of Layer 6 would be ASCII, JPG, and ASN.1. Just as I indicated
was the case with Layer 5, some protocol functions performed in other layers
fit nicely into the description of the presentation layer.
Layer 7: Application Layer
Many people confuse Layer 7 with the applications used on servers or workstations.
Application layer protocols are not user applications but instead the
protocols that allow those applications to operate over a network. A user
browsing the Internet with Internet Explorer utilizes an application layer protocol
called HTTP. Microsoft Word users saving files to a network server make
use of the Server Message Block (SMB) protocol. To a user, a network drive
simply appears as G:/, but in the background there are powerful application
layer protocols that allow G:/ to represent a location on a remote server. Other
examples of application layer protocols are FTP and Telnet.
有很多描述OSI/TCP/IP协议的文档,其中有很多都是翻译过来的,有很多翻译得非常不错。个人推荐结合原版英文文档,这样有很多概念的东西,理解得会更加深刻。恩,今天我们对协议的讨论就到此,主要是协议分层体系,各层之间的关系,各层的分工作用。有兴趣的朋友参考相关的RFC文挡,这个是一个非常重要的学习过程,也许一些意想的东西你会收获的。
呵呵。。今天到此为止拉。最近都挺忙,感觉有点累,一会出去好好运动,玩下刺激的篮球运动.