For example, your program is serverU, which is an FTP server program. By default, its open port is 2 1.
But if your program is cuteFTP, a client program, which is used to connect to the FTP server, then the ports used each time are random.
Moreover, even the server program written by ourselves will generally put the parameter port as a variable in the configuration file, and the port is determined by the content of the configuration file.