Code Archaeology
Mar 12, 2026 · Backend Development
SO_LINGER Demystified: Controlling TCP Close Behavior in Linux
This article explains the SO_LINGER socket option's three closure modes, demonstrates why SO_LINGER=0 sends RST instead of FIN, and outlines Linux's preferred solutions for TIME_WAIT accumulation—connection reuse, tcp_tw_reuse, tcp_fin_timeout, and port range expansion—over abrupt connection termination.
Linux kernelSO_LINGERTCP
0 likes · 16 min read
