A program on machine X attempts to open a UDP connection to port 5376 on a…

2006

A program on machine X attempts to open a UDP connection to port 5376 on a machine Y, and a TCP connection to port 8632 on machine Z. However, there are no applications listening at the corresponding ports on Y and Z. An ICMP Port Unreachable error will be generated by

  1. A.

    Y but not Z

  2. B.

    Z but not Y

  3. C.

    Neither Y nor Z

  4. D.

    Both Y and Z

Attempted by 41 students.

Show answer & explanation

Correct answer: D

Concept

ICMP's Destination Unreachable (Type 3), Port Unreachable (Code 3) message is a network-layer report, generated when a host cannot demultiplex an arriving unit to a listening process at the targeted port. The standard/accepted convention for this kind of question (per RFC 792's protocol-agnostic definition of the message, and standard references such as Forouzan) treats this network-layer reporting as independent of the transport protocol above it. A transport protocol may additionally have its own way of signalling a closed port — TCP can reply with a segment whose RST flag is set — but under this convention that transport-level signal doesn't switch off the network layer's own reporting; the two are treated as operating independently, so a failed demultiplexing is taken to produce an ICMP Port Unreachable at the destination whether the arriving unit was a UDP datagram or a TCP segment.

Application to this problem

  1. X's UDP datagram reaches Y at port 5376, where no process is listening. UDP itself has no mechanism to notify X of the failure, so Y's network layer reports the demultiplexing failure to X as an ICMP Port Unreachable.

  2. X's TCP segment reaches Z at port 8632, where no process is listening either. Under the same convention, the demultiplexing failure at Z is the same class of network-layer event as at Y, so Z's network layer also reports it as an ICMP Port Unreachable to X — independent of whatever additional RST segment Z's TCP stack may send at the transport layer.

So the ICMP Port Unreachable error is generated by both Y and Z.

Cross-check

Some treatments instead stress that TCP's own RST already tells the sender the port is closed, and read TCP as relying only on that transport-level signal rather than also invoking ICMP — under that reading only Y (the UDP destination) would generate the message. This is why the case is genuinely debated. But the standard/accepted position for this question — matching the exam's own answer key, GATE-PYQ archives, and Forouzan-style textbook treatment — keys the network layer's behaviour to demultiplexing failure alone, not to whether the transport protocol has its own separate signal, so both Y and Z are taken to generate the ICMP Port Unreachable.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir