首先要對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.
保證所有封包以正確的順序分發(fā)
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.
保證發(fā)送端發(fā)送數據的速度不超過接收端接收數據的速度。
?
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.