1

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!!!

RV186
  • 303
  • 2
  • 3
  • 12
  • 2
    Answers: 1. Yes 2. Yes 3. Depends on the operating system you are using. 4. Depends on the operating system you are using 5. Default port of RDP is 3389. – Rav Oct 18 '16 at 08:17
  • @Ronald ohhh!!! in the 5th one, as you said here that the default port is 3389. But, this can be changed right? And the port number that we mention, is it the source port or the destination port? and for the 3rd and 4th question, I am using Linux. – RV186 Oct 18 '16 at 08:59
  • Ports are layer-4 addresses, and they are per protocol. For instance TCP port 54321 is not the same as UDP port 54321. Different processes could use those two ports at the same time because they are different ports due to being in different protocols. – Ron Maupin Oct 18 '16 at 14:59
  • @RV186 Yes you can. Kindly upvote my comment please. :) – Rav Oct 20 '16 at 01:09

2 Answers2

2

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.

user207421
  • 305,947
  • 44
  • 307
  • 483
-1

Here is more clarification:

I heard, there are 65536 ports.

A port is 16 bit i.e. 2^16 =65536 so right

"Port Zero does not officially exist. It is defined as an invalid port number. But valid Internet packets can be formed and sent over the wire to and from port 0 just as with any other ports." https://www.grc.com/port_0.htm

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

You do not care about a system, you care about an IP. For every Ip you can use 65536 processes 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?

Of course, otherwise there will be a port conflict.

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

Refer my post here https://stackoverflow.com/a/54760498/2197108

Netstat: in Linux and Windows displays connections and ports

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

It should be clear now

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

Remote desktop asks for IP address of the remote machine. However, it may ask for user credentials of the remote machine.

In case it asks for IP and Port it means IP and Port of the remote desktop software (server) in the remote machine.

Mosab Shaheen
  • 1,114
  • 10
  • 25