# Q2(b) · Telnet connection ports

Subject: Computer Networks

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/cn/#tee/papers/paper-2024-feb-ai-reexam/q2b

Canonical: https://deep-learning-study-room.vercel.app/read/cn/tee/papers/paper-2024-feb-ai-reexam--q2b/

Exact historical variant. Current-syllabus questions solved; excluded topics and source limitations stated.

### Q2(b). A and B initiate Telnet sessions to S. Give possible ports for A→S and S→A. If A and B are different hosts, may their source ports be equal? 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.

Swipe across the diagram to read its labels ↔

![Transport: from hosts to application processes](https://deep-learning-study-room.vercel.app/cn/fig/tee-ports.f496c69028.svg)

Diagram: Transport: from hosts to application processes. Labels: Transport: from hosts to application processes | Transport: from hosts to application processes | Host address selects the machine/interface | Example destination: 198.51.100.20. | Protocol + destination port select service | TCP port 443 and UDP port 53 identify different transport endpoints. | Demultiplex to the right socket | TCP clients share server port 443; their address/port tuples distinguish the connections.

Several applications share IP connectivity; ports separate their transport endpoints.

1. At the sender, transport multiplexing accepts data from several application sockets and adds the appropriate header.
2. A server normally listens on a known service port; a client commonly chooses a temporary local port.
3. At the receiver, demultiplexing uses protocol/header information to deliver data to the appropriate socket.
4. 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 |

#### Practical example

Laptop 192.0.2.10:51000 contacts server 198.51.100.20:443. Another browser connection uses local port 51001, so the server can distinguish both TCP connections.

**Yaad rakho:** IP host tak; port process tak.

| Direction | Source port | Destination port |
| --- | --- | --- |
| Client→server | Example49152 | 23 (Telnet) |
| Server→client | 23 | 49152 |

Different client hosts may both use49152: their different source IP addresses distinguish the four-tuples. The server keeps separate connection state.
