Computer networks (21) and UDP port numbers Introduction

The port number

1. Define the port number

The data link and IP address, respectively, refer to the MAC address and IP address. The former is used to identify the same link in the different computers, which is used to identify hosts and routers on TCP / IP network interconnection.
Port number used to identify the same machine for different applications to communicate. Therefore, it is also called the program address.

2. The port number identifies the application

On a computer you can execute multiple programs simultaneously.
The transport layer protocol is the use of these ongoing application communication port number for identifying the machine, and accurately transfer data.
The port number identifies the application

3, port number, protocol number identified by the IP address to communicate

Identifying a destination port alone is not enough of a communication.
TCP / IP or UDP / IP communication is typically employed to identify one of five information communication.
They are the "source IP address", "Destination IP Address", "Agreement number", "source port number", "destination port number."
As long as an item is different it is considered other communications.
Identifying a plurality of requests

4. How to determine the port number

a. the established standard port numbers

It is a static method. It means that each application has its port number specified. But not to say that can use any port number. Each has its own port number corresponding to the purpose of use.
Port number HTTP, TELNET, FTP and other widely used application protocol used is fixed. These port numbers are also called well-known port number.
Usually well-known port numbers assigned from a number from 0 to 1023. Applications should avoid using well-known ports for communication other than the intended purpose, in order to avoid conflict.
In addition to the well-known port numbers, and some port number is also officially registered. They are distributed between the numbers 1024 to 49,151. However, these port numbers may be used for any communication purposes.

b. Method timing assignments

使用时序分配法,服务端有必要确定监听端口号,但是接受服务的客户端没必要确定端口号。
在这种方法下,客户端应用程序可以完全不用自己设置端口号,而全权交给操作系统进行分配。操作系统可以为每个应用程序分配互不冲突的端口号。
根据这种动态分配端口号的机制,即使是同一个客户端程序发起的多个TCP连接,识别这些通信连接的5部分数字也不会全部相同。
动态分配的端口号取值范围在49152到65535之间。

5.端口号与协议

端口号由其使用的传输层协议决定。因此,不同的传输协议可以使用相同的端口号。
端口号上的处理是根据每个传输协议的不同而进行的。
数据到达IP层后,会先检查IP首部中的协议号,再传给相应协议的模块。
即使是同一个端口号,由于传输协议是各自独立地进行处理,因此相互之间不会受到影响。
那些知名端口号与传输层协议并无关系,只要端口一致都将分配同一种程序进行处理。
目前来看,由于HTIP通信必须使用TCP, 因此UDP的80端口并未投入使用。
注:具有代表性的知名端口号,可查看《图解TCPIP》6.2端口号小节。

UDP

1.UDP的特点

1.UDP not provide sophisticated control mechanisms, to provide communication services using IP connectionless-oriented. It is sent to the application data received at that moment, a mechanism to immediately send on the network as it is.
2. Even in the case of the emergence of network congestion, UDP can not perform flow control to avoid network congestion behavior.
3. Even if packet loss occurs during the transmission, UDP is not responsible for retransmission. Even when the package reaches the order of appearance of a mess and no correction function.
4. If the details of the above-described control, it had referred to the application using the UDP process.
5. requires the user to take full account of good upper layer protocol and make the appropriate application. It can be said, UDP according to "those who act at the direction of the production process."

2.UDP use

UDP used to look: the
less the total amount of 1 packet communication (DNS, SNMP, etc.)
2. The video, audio and other multimedia communication (IM)
3. The application communication limited to the particular network such as a LAN
4. The broadcast communication ( broadcast, multicast)

Guess you like

Origin blog.csdn.net/NEUChords/article/details/91814616