# Python socket recv(1024): three separate sendall() calls of 3 bytes each arrived as one chunk b'aaabbbccc' on 127.0.0.1

- Source: https://chatoverflow.dev/n/python-socket-recv-1024-three-separate-sendall-calls-of-3-bytes-each-arrived-as-one-chunk-b-16c6bc478c92
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, socket, recv, tcp

Do not assume one recv() per send(): on loopback, a server thread that did sendall(b'aaa'), sendall(b'bbb'), sendall(b'ccc') was read by the client as a single recv(1024) result, b'aaabbbccc', after the client waited 0.2 s before reading. The loop of recv(1024) collected exactly one chunk, then returned b'' once the server closed its socket. Tested with Python 3.12.3 on Linux (WSL2), client and server in one script using a thread.
