Computer Network & Network Security System — Transport Layer, NEC licence examination syllabus (Nepal Engineering Council).
Your laptop has ONE IP address but is probably running fifty network conversations right now.
An IP address gets data to the right MACHINE. A port number gets it to the right PROCESS on that machine — like an apartment building's street address (IP) plus an individual apartment number (port).
Well-known0–1023. Reserved for standard services (HTTP=80, HTTPS=443, FTP=21).
Registered1024–49151. Assigned to specific applications by IANA, but not as strictly controlled.
Dynamic/Ephemeral49152–65535. Temporarily assigned to client applications for the duration of one connection.
A socket address is simply the combination of an IP address + a port number — this exact pair is what uniquely identifies one specific connection, out of potentially thousands happening at once on the same machine.
The ranges look like bureaucracy until you ask how a client finds a server it has never contacted.
A browser openingexample.com has no prior arrangement with that machine. DNS gives it the IP address, but nothing tells it which port the web server is listening on — so the port number must be a convention known in advance. Port 80 for HTTP and 443 for HTTPS are fixed precisely so no negotiation is needed before the first message.
A client's port number does not need to be predictable — nobody initiates a connection to it. It only needs to be unique on that machine, so replies can be matched to the right conversation.
So the OS allocates one from the ephemeral range automatically and reclaims it when the connection closes. Two browser tabs contacting the same server get different ephemeral ports, which is exactly what makes their 4-tuples distinct.
The terms are used loosely and questions test the difference.
PortA 16-bit number identifying a process endpoint on a host.
Socket addressThe pair (IP address, port) — enough to identify an endpoint on the whole internet.
SocketThe programming object the OS gives an application to read and write through, described in the Socket Programming topic.
Create a free account to tick topics off, take notes as you read, watch the video lessons and get a day-by-day study plan built around your exam date.
Loading…