I found, that buffer size can be set this way
sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 1) # Buffer size 8192
I set only 1 byte for the test. Let's send some big amount of data:
cat file.txt | nc -l 1489
But, I'm still able to get more than 1 byte here..
while 1:
read_ready = select.select([sock], [], [], timeout_in_seconds)
if read_ready[0]: # we have what to read
data = sock.recv(1000)
It looks like buffer size is enough to keep all data from file, and it is obviously not 1 byte, what we set above.