Skip to content
Tagged articles

SO_LINGER

3 articles · Page 1 of 1
Code Archaeology
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
SO_LINGER Demystified: Controlling TCP Close Behavior in Linux
360 Zhihui Cloud Developer
360 Zhihui Cloud Developer
Nov 14, 2019 · Fundamentals

How to Replace TCP FIN with RST Using SO_LINGER in Go

This article explains why TIME_WAIT occurs, its resource impact, and demonstrates two optimization strategies—accelerating TIME_WAIT reclamation and using the SO_LINGER option to send an RST packet instead of the normal FIN handshake, with complete Go client and server examples and packet‑capture analysis.

RSTSO_LINGERTCP
0 likes · 8 min read
How to Replace TCP FIN with RST Using SO_LINGER in Go