Quiz Entry - updated: 2026.07.14
How do UDP server and client processes work with port numbers?
The server listens on a well-known or registered port; the client picks a dynamic source port (49,152-65,535) and targets the server's well-known port, reusing the same port pair for the whole transaction. The reply swaps source and destination so it reaches the right client app.
UDP Server and Client Communication:
Server Side:
- Applications assigned well-known or registered port numbers
- Server listens on specific ports
- Examples: DNS on port 53, RADIUS on port 1812
Client Side:
- Dynamically selects a source port (49,152 - 65,535)
- Uses well-known port as destination
- Same port pair used for entire transaction
Example - DNS Query:
Client Request:
Source Port: 49152 (dynamic)
Destination Port: 53 (DNS well-known)
Server Response:
Source Port: 53
Destination Port: 49152
Port Number Rules:
| Direction | Source Port | Destination Port |
|---|---|---|
| Client → Server | Dynamic (random) | Well-known/Registered |
| Server → Client | Well-known/Registered | Client's dynamic port |
Key insight: The server's response uses the client's source port as the destination, ensuring the reply reaches the correct application.
Go deeper:
Port (computer networking) — how the dynamic source port and well-known destination port demultiplex UDP traffic.
RFC 768 — User Datagram Protocol — the spec defining UDP's source and destination port fields.