Tagged articles
3 articles
Page 1 of 1
Liangxu Linux
Liangxu Linux
May 14, 2025 · Fundamentals

Can TCP and UDP Share the Same Port? A Deep Dive into Port Mechanics

This article breaks down the interview question "Can TCP and UDP use the same port?" by examining protocol-level port spaces, client‑side TCP and UDP port sharing rules, server‑side TCP reuse with SO_REUSEADDR, and UDP reuse with SO_REUSEPORT, complete with code examples and practical implications.

Network programmingPort SharingSO_REUSEADDR
0 likes · 17 min read
Can TCP and UDP Share the Same Port? A Deep Dive into Port Mechanics
Liangxu Linux
Liangxu Linux
Jan 17, 2021 · Fundamentals

When Do SO_REUSEADDR and SO_REUSEPORT Actually Take Effect? A Deep Dive

This article explains the differences and interactions between the SO_REUSEADDR and SO_REUSEPORT socket options, shows how they behave on BSD and Linux kernels across versions, and provides code examples and tables to illustrate binding rules, TIME_WAIT handling, and the evolution of reuse‑port support.

Linux kernelSO_REUSEADDRSO_REUSEPORT
0 likes · 14 min read
When Do SO_REUSEADDR and SO_REUSEPORT Actually Take Effect? A Deep Dive