Port Numbers
๐ป cs๐ป cs2003๐ web๐ networks
An IP address is like an apartment, and the port number is like the flat number within that building.
Port numbers enable multiplexing. A single device can have multiple applications or services running simultaneously, each needing to communicate over the network. Port numbers allow the operating system to distinguish between these different communication streams and direct incoming data to the correct application.
For servers to uniquely identify multiple services belonging to the same IP, port numbers add to the distinction.
Port numbers are 16 bit unsigned integers. Hence. the maximum value can be 2^16 which is 65,535.
Port numbers lie on layer 4 (transport layer) of the TCP/IP model .
TCP and UDP ports are independent of each other, which means that both a TCP service and a UDP service can be running on the same port number!
So, you can deduce that;
You can have 2 applications in same IP AND same port provided one uses TCP and the other UDP, but you cannot have 2 applications with the same IP, port, and protocol!
These ports can be well known ones assigned by IANA or ephemeral (dynamic).
Ranges
- Well-known Ports (0-1023): Reserved for system-level services and common protocols (e.g., HTTP on port 80, HTTPS on 443, FTP on 21).
- Registered Ports (1024-49151): Can be registered for specific services or applications, but not strictly enforced.
- Dynamic/Private Ports (49152-65535): Also known as ephemeral ports, these are typically assigned dynamically by the operating system to client applications for temporary communication sessions.
rispondi al post