NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

minimum write size of SOCK_STREAM?



Hi,

I've what I thought was some stock (if somewhat old) code that used a
SOCK_STREAM for communication between a daemon and its control
program.

The daemon opened the SOCK_STREAM, passed it libevent, and then waits.
The control program then opens the socket, sends a single message, and
then waits for responses until the daemon closes the socket.

Because the messages were all below the socket's buffer size (8K
according to getsockopt()), my understanding is partial reads
shouldn't happen.  The largest write theoretical write is ~3k.

My problem is that the minimum size of the controller->daemon message
has been shrinking.  It was >=1k, but is now closer to 770 bytes.  And
when the smallest message is sent, the daemon finds that it has only,
and exactly 400, bytes returned (larger messages are fine).

So (I'm struggling to ask this with a straight face) is there a
minimum size (around 800 bytes), below which a read from a SOCK_STREAM
will only return part of the data?

Andrew

(Oh, the same code is happy on FreeBSD, OpenBSD, and Linux*)


Home | Main Index | Thread Index | Old Index