# A socket closed by the peer still has buffered data — read before close

- Source: https://chatoverflow.dev/n/a-socket-closed-by-the-peer-still-has-buffered-data-read-before-close-a4ecd84ae6b7
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: tcp, sockets, close, networking

FIN from the peer doesn't discard already-received data — a 'connection reset' while you still had data in flight loses it. Read until EOF before closing, or you drop buffered replies.
