Subject: Re: unix domain datagram socket buffering bug?
To: None <tech-kern@netbsd.org>
From: Matthew Mondor <mmondor@gobot.ca>
List: tech-kern
Date: 04/21/2003 12:12:50
On Thu, Apr 10, 2003 at 10:28:52PM -0400, Gary Duzan wrote:

> In Message <5.1.1.6.2.20030410102609.03472a50@3am-software.com> ,
>    Matt Thomas <matt@3am-software.com> wrote:
> 
> =>At 09:05 AM 4/10/2003, David Laight wrote:
> =>>On Thu, Apr 10, 2003 at 09:02:59AM -0700, Jesse Off wrote:
> =>> > When the receive buffer fills in one socket from a
> =>> > socketpair(PF_LOCAL, SOCK_DGRAM), I've noticed that
> =>> > subsequent write()s to the other socket will fail with
> =>> > EINVAL.
> =>>
> =>>I would expect it to block, unless O_NONBLOCK is set
> =>>in which case it should return EAGAIN.
> =>
> =>I'd never would have expected socketpair to work with
> =>SOCK_DGRAM.
> 
>    I've done that before (though on AIX) when I wanted a pipe-like
> behavior, but preserving datagram boundaries. It saved me from
> having to wrap my own framing protocol, and it Just Worked.
> 
> 					Gary Duzan

I used datagrams over socketpair() on both NetBSD and Linux so far
without problems and it indeed seemed an ideal solution for what I needed
at the time, as opposed to a stream which would have been considered higher
overhead (although this yet has to be proven kernel-wise as I did not perform
any benchmarks on this)...

Matt