My doubt is that - a port is just logical, so why such restriction ? Why can't I have a port of 9924593 or something like that ?
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 port identifiers are unsigned 16-bit integers, meaning that the largest number you can put in there is 216-1 = 65535.
The maximum value is 65535. The TCP/IP network port number for IPv4 is an unsigned 16-bit integer, which can be no more than 65535.
65,536 is a very common number in computing, because it's 2 to the power of 16 (2^16). 2^8 is 256, and 65,536 is the square of 256. In other words, a 16 bit binary number can represent 65,536 different integers. So that's probably where your 65,535 range comes from.
Look at the packet format for the TCP segment. The port identifiers are unsigned 16-bit integers, meaning that the largest number you can put in there is 216-1 = 65535.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With