Computer Networks · TEE · papers
Q7(c) · TCP server sockets
2023-01-27 · AI-only Sem V
Exact historical variant. Current-syllabus questions solved; excluded topics and source limitations stated.
Q7(c). A web server on host C port 80 uses persistent connections from two different hosts A and B. Are their requests passed through the same socket on C? If different sockets, do both have port 80? Explain. [5 marks]
Answer
IP delivers a packet toward a host interface. The transport layer delivers application data to a process endpoint, identified using a port. A socket endpoint is commonly described by IP address and port; the protocol also matters. TCP distinguishes connections by source IP/port and destination IP/port.
- At the sender, transport multiplexing accepts data from several application sockets and adds the appropriate header.
- A server normally listens on a known service port; a client commonly chooses a temporary local port.
- At the receiver, demultiplexing uses protocol/header information to deliver data to the appropriate socket.
- A TCP connection is bidirectional and maintains state. Two clients can contact the same server port because their connection tuples differ. UDP demultiplexing is connectionless at the protocol level; applications can still keep their own state.
| Identifier | Purpose |
|---|---|
| MAC address | Delivery on a local link |
| IP address | Network-layer interface/addressing |
| Port number | Transport-layer application endpoint |
| Domain name | Application-level naming resolved through DNS |
Yaad rakho: IP host tak; port process tak.
An established TCP connection is identified by source IP, source port, destination IP, destination port. IP addresses come from the IP header; port numbers come from the TCP header. The transport protocol distinguishes TCP from UDP.
A web server’s listening socket accepts connections on port80. Accepted connections from A and B use distinct connection sockets/state, although both server-side local ports remain80. Different remote IP/port pairs distinguish them. Persistent connections reuse their own established socket for subsequent requests.