Dynamic port(49152 ~ 65535) usage question

Woong Kyu 1 Reputation point
2022-07-19T04:49:41.067+00:00

OS : Windows 10 64bit

I have a question about the following.

There are two programs that use Dynamic Port (49152 ~ 65535).

I want to know how these two programs are assigned a port.

Q1) If [Program #1] is using Port 49152 first, will [Program #2] use a port other than Port 49152?

Q2) I want to know if there is a problem with multiple programs using the same port in the dynamic port band.

Thanks

Windows 10 Network
Windows 10 Network
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Network: A group of devices that communicate either wirelessly or via a physical connection.
2,288 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dillon Silzer 54,831 Reputation points
    2022-07-19T05:11:29.98+00:00

    1) Typically, you only have one port listening per application.

    2) If you want multiple programs to run on a single machine you would need two Network Interface Cards (NICs) with two different IP addresses listening for the same port #. One program would go to one IP address for one application and the other would go to the secondary IP address (same port numbers, different IP addresses).

    This is why ports exist so multiple applications can exist on the same machine and communicate different information.

    Same question was asked on stackoverflow:

    Can two applications listen to the same port?

    https://stackoverflow.com/questions/1694144/can-two-applications-listen-to-the-same-port#:~:text=You%20can%20only%20have%20one,subscribe%20to%20the%20same%20port.


    Define Dynamic Ports

    Dynamic ports—Ports in the range 49152 to 65535 are not assigned, controlled, or registered. They are used for temporary or private ports. They are also known as private or non-reserved ports. Clients should choose ephemeral port numbers from this range, but many systems do not.

    The private, or dynamic, port numbers are used by clients and not servers. Datagrams sent from a client to a server are typically only sent to well-known or registered ports (although there are exceptions). Server applications are usually long lived, while client processes come and go as users run them. Client applications therefore are free to choose almost any port number not used for some other purpose (hence the term “dynamic”), and many use different source port numbers every time they are run.

    Cited from https://www.sciencedirect.com/topics/computer-science/registered-port#:~:text=Dynamic%20ports%E2%80%94Ports%20in%20the,but%20many%20systems%20do%20not.


    If this is helpful please mark as correct answer.