Search code examples
networkingportsport-number

Port number concepts?


I am trying to understand the concept of port number. As much as I know it identifies a specific process or a network service. Can anyone give me a real life example. So, it could be easier to understand. Some doubts that I currently have-

  1. I heard, there are 65536 ports. Does, that mean, a system can identify 65536 processes simultaneously?
  2. I have seen that some ports are reserve for some specific service. So, does it mean, it can't be used for any other service?
  3. What is the command to know which port numbers are free or to use?
  4. What is the command to know which port numbers are not free and what are they used for?
  5. If I try to access a system through remote desktop from my computer, it asks for a port number. What should I mention?

If possible please share a link. I am currently getting confused with too much technical theory. Thank you!!!


Solution

  • I heard, there are 65536 ports.

    You heard wrong. There are 65535: 1 .. 65535. Zero is not a valid port number.

    Does, that mean, a system can identify 65536 processes simultaneously?

    It means a system can identify 65535 ports simultaneously.

    I have seen that some ports are reserve for some specific service. So, does it mean, it can't be used for any other service?

    That is the meaning of the word 'reserve'.

    What is the command to know which port numbers are free or to use?

    It isn't a command. It is either a search at the IETF website for reserved ports or the use of the number zero, which means the next available port.

    What is the command to know which port numbers are not free and what are they used for?

    It isn't necessarily a command. It is a search at the IETF website for reserved ports, or the netstat command for ports actively in use on the localhost.

    If I try to access a system through remote desktop from my computer, it asks for a port number. What should I mention?

    The port number that you're trying to connect to in the remote system.