Ports, sockets and connection identity
IP addresses and ports do different jobs
An IP address identifies a network-layer destination; TCP and UDP port fields help the receiving stack direct data to the appropriate transport endpoint. A port is a 16-bit number, not a physical connector. TCP and UDP have separate port namespaces. A socket is an operating-system communication object; a socket address identifies an endpoint (for IP transports, an IP address and port, with protocol context). A socket object is not simply a port number.
Identify simultaneous flows
A five-tuple lists transport protocol, source IP, source port, destination IP and destination port. In the same network context, two TCP connections may share a server IP and port but differ in their client endpoints. The reverse direction swaps the source and destination pairs; it belongs to the same bidirectional TCP connection. UDP can also be classified by a five-tuple, but that does not make it a TCP-style connection. These addresses are reserved for documentation.
A: TCP 192.0.2.10:52000 -> 198.51.100.20:443B: TCP 192.0.2.10:52001 -> 198.51.100.20:443C: UDP 192.0.2.10:52000 -> 198.51.100.20:443A reverse: TCP 198.51.100.20:443 -> 192.0.2.10:52000Service conventions and ephemeral ports
The IANA registry divides ports into system (0–1023), user (1024–49151), and dynamic/private (49152–65535) ranges. Port zero is reserved in the registry; a socket API may interpret a requested local port of zero as automatic allocation. Operating systems select temporary client ports using configurable ranges, which need not equal the IANA dynamic range. A server commonly listens on TCP 443 for HTTPS, but a number alone cannot establish what protocol is actually carried or whether traffic is trustworthy. UDP 443 can be used by QUIC-based HTTPS, and alternate ports are possible.
Listening addresses and reachability
For an IPv4 server, binding only to 127.0.0.1 normally limits ordinary connections to the local host. Binding to 0.0.0.0 is a wildcard for local IPv4 addresses, not a remote destination to dial. A listener bound to one specific interface address does not automatically listen on every other address. IPv6 uses :: as its wildcard; IPv4-mapped behavior depends on socket settings and the OS. Binding is not a guarantee of outside reachability: routes, firewalls, NAT and application access policy still matter.
Read evidence, not guesses
Suppose a fictional client receives a reset while connecting to a TCP endpoint. That is different evidence from a timeout, where no expected response arrives before the deadline. A reset can indicate rejection or absence of a listener, but intermediaries and other conditions can produce similar results. A timeout does not prove a firewall blocked the traffic. Check the protocol, endpoint, listener scope, path and application response separately in an authorized environment. Practice: two flows with identical IPs and ports but different transport protocols have different five-tuples.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Ports, sockets and connection identity — knowledge check
Interpret fictional transport observations and calculate expected results.
Two TCP clients use the same server IP and port but different client ports. How many distinct five-tuples are present in the client-to-server direction?
Only the transport protocol differs between two otherwise identical tuples. What follows?
Which value lies in the IANA dynamic/private port range?
An IPv4 listener is bound only to 127.0.0.1. What is its usual direct reachability?
A client times out when connecting to a server. Which conclusion is supported?