The unreliability of AF_UNIX datagram sockets
Corinna Vinschen
corinna-cygwin@cygwin.com
Thu May 20 19:25:59 GMT 2021
On May 20 09:46, Ken Brown wrote:
> On 4/29/2021 7:05 AM, Corinna Vinschen wrote:
> > I think it should be possible to switch to STREAM sockets to emulate
> > DGRAM semantics. Our advantage is that this is all local. For all
> > practical purposes there's no chance data gets really lost. Windows has
> > an almost indefinite send buffer.
> >
> > If you look at the STREAM as a kind of tunneling layer for getting DGRAM
> > messages over the (local) line, the DGRAM content could simply be
> > encapsulated in a tunnel packet or frame, basically the same way the
> > new, boring AF_UNIX code does it. A DGRAM message encapsulated in a
> > STREAM message always has a header which at least contains the length of
> > the actual DGRAM message. So when the peer reads from the socket, it
> > always only reads the header until it's complete. Then it knows how
> > much payload is expected and then it reads until the payload has been
> > received.
>
> I think I'd like to go ahead and try to do this DGRAM emulation in the
> current (AF_LOCAL) code. It shouldn't be too hard, and it would solve the
> unreliability problem while we look for a better way to handle AF_UNIX
> sockets.
Yeah, sounds like the way to go for now.
Thanks,
Corinna
More information about the Cygwin-developers
mailing list