Why do Linux ports have ports

Source: Internet
Author: User

IP can lock a physical machine, corresponding to a network card, the external packet network card will receive. But the problem comes, the network card to the program provides an interface, you listen to me, if there is a message, I will forward to you. This will enable the application to receive data. But the problem comes, program A and program B all need to listen to the network card to send data, network card said that I received the data are sent to you two, you look at it. OK, small a small B has been accepted. But then came the cdef ..., no, every package was sent to all applications, and every application was exhausted and eventually collapsed.

OK, the network card said I give you add an expression, we can use a number to identify, between me and small A to identify, if the external to the 1th identification data I forwarded to you, you listen to me when you have to tell me when you listen to 1, I forwarded 1 of the packet to you. All right, the other BCD ... Make an identification number on your own, as long as you don't repeat it. It's easy for everyone.

Finally design to security, an identification number can only be monitored by an application , because if the small a program and small b at the same time listening to an identification number, it is bad, I pass the data are AB received, so that data security can not be guaranteed.

This identification number is the port, the original design of network data exchange designers do not know how to think. This is my understanding.

In fact, the network card is encapsulated by the system layer, the relationship between the port and process is also the system encapsulation good. We just need to use the socket, given a port number on the line. Everything else is given to the operating system.

The textual description is:

The port is the communication interface between the application layer process and the Transport Layer Protocol entity in the TCP/IP protocol cluster. A port is a resource that an operating system can allocate, and when an application is bound to a port through a system call, the data transmitted to the port is received by the corresponding process, and the data sent to the transport layer is output through the port.

Why do you need the concept of ports? In the process of network communication, you need to uniquely identify the endpoints on both ends of the communication, that is, using ports to identify applications running on a host. If no port is introduced, it can only be identified by the process number. Process numbers are dynamically allocated by the system, and different systems use different process identifiers, and the application does not know its own process number before it runs, and if it needs to be run, it is difficult to ensure the communication goes smoothly. When the port is introduced, the application can be identified by the port number and the public services such as HTTP and FTP are identified and used by the fixed port number.


This is my understanding, I hope everyone to correct the shooting bricks.

Why do Linux ports have ports

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.