The Transmission Control Protocol (TCP) uses a set of communication channels called ports to manage system messages between different applications running on the same physical device. Unlike physical ports on computers, such as USB ports or Ethernet ports, TCP ports are virtual: programmable entries with numbers between 0 and 65535.
TCP vs UDP Comparison
Most TCP ports are general-purpose channels that can be called into service when needed, but otherwise remain unused. However, some lower-numbered ports are dedicated to specific applications. While many TCP ports belong to applications that no longer exist, some are very popular.
TCP does not actually use port 0 for network communication, but it is well known to network programmers. TCP socket programs use port 0 by convention to allow the operating system to choose and assign an available port. This saves a programmer from having to choose ("hardcode") a port number that might not work well for the situation.
FTP servers use TCP port 21 to manage their side of FTP sessions. The server listens for FTP commands coming in on this port and responds accordingly. In active FTP mode, the server also uses port 20 to initiate data transfers back to the FTP client.