TCP protocol port refers to what specifically is, why we need port, how do you understand?

In fact, you are asking someone else the concept of a port, a lot of explanations are machine is a room, the window is like a machine port. This interpretation is basically useless or misleading.

I also checked the Internet a bit, basically the above explanation. From my own will have to understand why the port, how to plan the port, see below.

ip a physical machine can be locked, corresponding to a card, the data packet sent outside the card will be received. But here, the card provides an interface to the program, what you listen to me, if there is a message, I will forward it to you. Such applications will be able to receive the data. But the question is, Program A and Program B will need to listen for sending and receiving data card, the card says that I have received the data sent to you two, you can figure it out. Good, small A small B are accepted. But again CDEF ......, die, each packet is sent to all applications, each application so tired, eventually collapsed.

Well, I say to you that the card plus a representation of it, you can use a number as an identifier between us, between me and the small A to use 1 to identify if the data sent to the outside world No. 1 logo I will forward it to you you have to listen me when I tell you listening 1, I will forward the data packet to 1 of you. Well, all the other BCD ... get yourself an identification number, it does not repeat on the line. So that everyone save trouble.
Final design to safety, an identification number can only be a listener application, because if the small A and small B program while monitoring a number identification number, it is bad, I pass the data has been received AB, so data security no way guaranteed.

This identification number is the port, network designers originally designed for data exchange do not know how to think. This is my understanding.

In fact, the cards are system layer encapsulates the relationship between the port and the process is packaged systems. We only need socket on the line, given a port number on the list. Other things to the operating system to do it.


Reprinted knew almost https://www.zhihu.com/question/22577025/answer/31046824

Guess you like

Origin blog.csdn.net/tc291695377/article/details/59108253