首先要对OSI七层结构和TCP/IP四层结构要清楚。
OSI七层结构从上到下为
Application
Presentation
Session
Transport
Network
Data Link
Physical
TCP/IP四层结构为
把上面三层合为process层,把下面两层合为Hardware层得到
Process
Transport
Network
Hardware
协议所提供的各种服务:
Connection-oriented (virtual circuit) or connectionless– Connection-oriented requires the protocol to establish a logical connection before communicating. Data can then be transferred until the connection is terminated. With the TCP/IP protocol suite, TCP is connection-oriented and UDP is connectionless.
Connection-oriented的典型代表是TCP,需要在联系前首先要建立一条连接。
connectionless的典型代表是UDP,不需要事先建立连接。
Sequencing – makes sure that packets are delivered in the same order they were sent.
保证所有封包以正确的顺序分发
Error control –handles data corruption and packet loss. Requires the receiver to acknowledge the sender and to discard duplicate the packet if an ACK is lost and the packet is then resent.
Flow control – makes sure the sender does not transmit data at a rate higher than the receiver can process the data.
保证发送端发送数据的速度不超过接收端接收数据的速度。
Byte steam or messages – a byte stream is a series of bytes rather than a series of messages. The higher layer protocols must then organize the bytes according to the application requirements.
Full-duplex or half-duplex – Full-duplex is bi-directional simultaneously. Half-duplex is uni-directional at a time. The direction varies with time.