A number assigned to user sessions and server applications in an IP network. The port number resides in the TCP or UDP header of the packet. See TCP/IP.|
The source port, which can be a random number, is assigned to the client and is used to keep track of user sessions. The combination of port number and IP address is called a "socket."
The destination port is used to route packets on a server to the appropriate network application. For example, port 80 is the standard port number for HTTP traffic, and port 80 packets are processed by a Web server. Destination ports are typically well-known ports (0-1023) for common Internet applications such as HTTP, FTP and SMTP. It can also be a registered port (1024-49151) that vendors use for proprietary applications. See well-known port.
Source Becomes Destination and Vice Versa
On the return trip response from the server, the destination port number and IP address become the source port number and IP address. Likewise, the source port and IP become the destination port and IP.
The software that responds to a port number is said to be "listening" for its packets. More accurately, the term should be "looking" for its packets, because it is comparing numbers, not "listening" to numbers. However, computer terminology has never been known for clarity. See port forwarding, TCP/IP, Unix socket and NAT.