bytes_read = read(client, buf + count, sizeof(buf) - count);

sizeof(buf) will always return  4 because buf was allocated as a char* and not a char[]
So it's never trying to read more than 4 bytes at a time

-albert