[Bug 17195] New: NamedPipe datagrams need to be _really_ datagrams

wine-bugs at winehq.org wine-bugs at winehq.org
Fri Jan 30 10:27:25 CST 2009


http://bugs.winehq.org/show_bug.cgi?id=17195

           Summary: NamedPipe datagrams need to be _really_ datagrams
           Product: Wine
           Version: unspecified
          Platform: Other
        OS/Version: other
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ntdll
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: lkcl at lkcl.net


ok, after a little bit of investigation, i think i understand the pipes code
enough to be able to say what's going on, and i'm seeing something like this:

process 1:

recvpipe = CreateNamedPipe("\\pipe\fred")
ReadFile(recvpipe, buffer, &length);
printf(length) ===> 43
ReadPipe(recvpipe, buffer, &length); /* no data */

process 2:

sendpipe = CreateNamedPipe("\\pipe\fred")
length = 9;
WriteFile(sendpipe, buffer, &length);
length = 34;
WriteFile(sendpipe, buffer, &length);


what's happening is that the data being sent down the pipes isn't being done as
datagrams.  the implementation is using a stream-based fd.

the solution is: you _must_ implement a protocol on top of the pipes which
sends the length (as a 32-bit int, whatever) which is read off the fd, followed
by the data stream of _exactly_ that length.

_must_.  there's no two ways about this.

the protocol of Pipes is unfortunately a combination of both datagrams and
streams.  datagrams because the lengths of data sent are absolute and
inviolate.  streams because the data order and reliability are _also_ absolute
and inviolate.

you can't use datagrams (because they're unreliable).  you can't expect all
unixen to support datagrams on top of unix sockets (if that's what's being
used).

so - you have to send the length, as part of the implementation of the
pipe-data-send.

sending a length will also solve the issue of trying to send zero-length pipe
datagrams.

as a first implementation, you _might_ be able to get away with assuming that
when someone asks for some data, they _will_ provide a buffer big enough.

... actually... i don't see any ERR_MORE_DATA error codes in NtReadFile, so
that would explain... this is going to get messy :)


-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list