On Thu, 30 Oct 2025 at 21:17, Andrew Cagney <[email protected]> wrote: > > 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?
857 bytes is good, 856 bytes is bad; and: ipsec whack: ERROR: bumping up buffer from 736 to 856 [root@rise source 141]# uname -a NetBSD rise 10.1 NetBSD 10.1 (GENERIC) #0: Mon Dec 16 13:08:11 UTC 2024 [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC amd64 > Andrew > > (Oh, the same code is happy on FreeBSD, OpenBSD, and Linux*)
