InterviewSolution
| 1. |
Why Port Numbers Are Just 65536? |
|
Answer» This is because limitation in TCP/IP stacks where the port FIELD is just 16 bit size. So we get only 2^16 port which is equal to 65536 ports. Port numbers have a range of 0…65535 (although often 0 has special meaning). In the original BSD TCP implementation, only ROOT can bind to ports 1…1023, and dynamically assigned ports were assigned from the range 1024…5000; the others were available for unprivileged static assignment. These days 1024…5000 is often not enough dynamic ports, and IANA has now OFFICIALLY designated the range 49152...65535 for dynamic port assignment. However even that is not enough dynamic ports for some busy servers, so the range is USUALLY configurable (by an administrator). On modern LINUX and Solaris systems (often used as servers), the default dynamic range now starts at 32768. Mac OS X and Windows Vista default to 49152...65535. This is because limitation in TCP/IP stacks where the port field is just 16 bit size. So we get only 2^16 port which is equal to 65536 ports. Port numbers have a range of 0…65535 (although often 0 has special meaning). In the original BSD TCP implementation, only root can bind to ports 1…1023, and dynamically assigned ports were assigned from the range 1024…5000; the others were available for unprivileged static assignment. These days 1024…5000 is often not enough dynamic ports, and IANA has now officially designated the range 49152...65535 for dynamic port assignment. However even that is not enough dynamic ports for some busy servers, so the range is usually configurable (by an administrator). On modern Linux and Solaris systems (often used as servers), the default dynamic range now starts at 32768. Mac OS X and Windows Vista default to 49152...65535. |
|