NetBSD-Users archive

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

Re: minimum write size of SOCK_STREAM?



On Thu, 30 Oct 2025, Andrew Cagney wrote:

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.


What domain? AF_LOCAL or AF_INET{,6}?

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


With SOCK_STREAM, partial reads can always happen. If you want whole-packet
reads (< MTU size) you'll have to use SOCK_DGRAM or SOCK_SEQPACKET; or send
the message size too, so that the server can loop until it gets the whole
packet.

Let's see your code.

-RVP


Home | Main Index | Thread Index | Old Index