Several concepts
1. stratified (we use four-layer model more fitting our actual network)
Layering is why, in fact, the company and position is the same, different jobs people do different things, and different positions of the people together, complete with the matter of data transmission.
Link layer At this level, the interaction of the host with the host hardware mac only recognize numbers, did not know IP.
The network layer IP ICMP IGMP
Transport layer TCP UDP
Application Layer Telnet remote login, the FTP file transfer protocol (our ports and connectors that port is used to doing, to transfer files? You can use FTP. Transmission of text? You can use HTTP. The application layer is actually a specific program the interaction between the functional layer is defined.)
2. Interface Each interface on the Internet must have a unique IP address
Using TCP / IP protocol application usually two application programming interface ( the API ):
socket and the TLI (Transport Layer Interface: Transport Layer Interface ).
3. Package TCP passed IP data unit called TCP packets referred to as TCP segment or segments (TCP segment ).
IP passed to the network interface layer data units called IP datagrams (IP Datagram) . By comparing the Ethernet transmission Laid called a frame (Fr ame) stream .
IP : Network Protocol
I. Basic Concepts
All TCP , UDP , ICMP and IGMP data to IP transport datagram format . IP to each machine is like a house number, the network layer of the network, you can understand it as the mail transport workers, its function is responsible for a packet transport from the house to another house.
Unreliable (Unreliable ) mean it can not guarantee the IP datagram can successfully reach their destinations. If some error occurs, such as a router runs out of buffer temporarily, the IP has a simple error processing algorithm: discard the packet and send ICMP message packet to the source terminal. Any required reliability must be provided by an upper layer (e.g., the TCP ).
Connectionless IP data packets in the transmitted sequence may not be received. If a source to a same transmission data sink two consecutive packets (first A , then B ), each datagram is routed independently selected, may choose a different route, so B may be A first before reaching Arrivals.
But there are also connection-oriented virtual circuit and connectionless packet.
II. Routing algorithm
There is also a corresponding adaptive algorithm on the network and a non-adaptive algorithm (static routes, reliability) (dynamic routing, network routing table according to the refresh state).
( The Dijkstra shortest path algorithm, distance vector algorithm DistanceVector, link state algorithm )
Internet Protocol IP is TCP / IP one system, two major agreements. And IP support, there are three protocols used protocols:
ARP ARP (Address Resolution Protocol)
Internet Control Message Protocol ICMP (Internet Control Message Protocol)
Internet Group Management Protocol IGMP (Internet Group Management Protocol)
TCP transport layer
Compared to the transport layer is the introduction of different layer of the network the largest port concept. Just send the network layer address and a destination address. But the host may send more than one program and with a receiving host for transmission of data, how to distinguish between multiple programs do? It introduces the concept of port.
There is also a function of the transport layer is defined substantially transmitting and receiving packet handling behavior . Speaking above the network layer is equivalent to the mail transport workers, it is only responsible thing to put a package from one place to another place, however, whether this package delivery, and after service of the recipient and what behavior. These can be defined in the transport layer. Note here that is, you can transport layer fabric regardless, only a simple basic package in the quad. You know, I'm talking UDP.
Packet sequence number, used to solve the scrambled packet network (Reordering) problem.
Acknowledgement Number is used to acknowledge receipt of ACK--, to solve the problem without packet loss.
Window also known as Advertised-Window, which is the famous sliding window (Sliding Window), for solving flow control.
TCP Flag, which is the type of package is mainly used to manipulate the TCP state machine.
二、流量控制与滑动窗口
三、TCP建立连接和关闭的三次握手
client和server应该理解为发送方(客户端)和接收方(服务器)
三. 拥塞阻塞 明明网络已经堵塞了,还一个劲地发送大量包,甚至重发,那么这个时候,大家都没得玩了。于是,TCP引入了拥塞窗口(cwnd)的概念。
“每收到一个ACK,拥塞窗口就增加一个报文段”。
当然上图的情况太理想,实际的情况,坑cwnd为2的请求发出去两个报文包的时候,先返回了一个ACK,然后cwnd这个时候就为3,发送方就会继续发送请求包。。。
拥塞避免算法
慢启动使得cwnd是呈指数增长。一定不可能是无限增长的,这里就有个阀值,超过这个阀值,就进入拥塞避免算法。
先说拥塞避免算法,拥塞避免算法说的是拥塞窗口的增加不再是“每收到一个ACK,拥塞窗口就增加一个报文段”。 而是“每收到一个ACK,cwnd = cwnd + 1/cwnd”。
快速回复算法
快速恢复算法是为了不要有一个重传就那么大响应。能尽快恢复到网络流畅时候稳定的状态。
其他