Imagine for a moment that your computer is a big warehouse and you’ve taken the job of delivering received materials (messages) to their final destinations on the computer. You have a large number of people doing the prework of opening all the incoming boxes for you.
First, there’s the physical group that has to receive the message. These are the people that receive the incoming packages from the outside world. These packages arrive as electrical signals. The only thing this group must do is convert these electrical signals into a series of bits that can be processed by the next set of handlers.
The next set of handlers call those bits received from the physical group a link layer message. Their job is to open that package (take the header and trailer off) and deliver the package inside to the next set of handlers.
That next set of handlers call that package a network layer message. The job of the network layer message handlers is to open the package (again take the header and trailer off) and deliver the package to you.
Now you get what was in the network layer message. You have a transport layer package – typically either a UDP (Unigram Data Protocol) or TCP (Transport Control Protocol) message – to deliver to the final destination. How do you know where to deliver it?
Each of these messages is marked with a number called a port number, which is the final destination. That port number is nothing more than a 16-bit number that identifies a specific application in the receiving device. There are three categories of ports. Ports 0 to 1023 are well-known ports assigned to common protocols and services used by almost all users. Ports 1024 to 49151 are registered ports assigned to specific services. Ports 49152 to 65535 are unassigned and can be used as needed. The following table specifies the port number for some common applications that are used in control systems and building automation:
|HTTP (Web Browser)||Common||80|
|HTTPS (Web Browser Secure)||Common||443|
The combination of a port and an IP address is known as a socket to Ethernet application programmers using EtherNet/IP, Modbus TCP, PROFINET IO, or any other application layer industrial protocol. Sockets are allocated when a connection is initiated and released when the connection terminates. Sockets are important as programmable controllers have limited numbers of sockets (called connections by the controller vendors) available. It is possible to run out of connections (sockets) when connecting too many different applications (gateways, historians…etc.) to a programmable controller.
But you don’t care about those sockets as the computer warehouse manager. All you care about is that port number table so you can deliver the right message to the right application.