[jcifs] Problem reading multiple writes from named pipe

Michael B.Allen Michael_B_Allen at ml.com
Thu Apr 10 13:42:39 EST 2003


On Wed, 9 Apr 2003 19:48:46 -0400
"Eric Sword" <ericsword at grouplogic.com> wrote:

> There is still a problem in the underlying stream handling I believe.
> At least on Windows, if the in.read call (in PipeTalk's ReceiverThread
> class in this case) does not read all data from a corresponding write, I
> see this exception thrown:
> 
> jcifs.smb.SmbException: No description available [ERRDOS/234]
>         at jcifs.smb.SmbTransport.send(SmbTransport.java:496)
>         at jcifs.smb.SmbSession.send(SmbSession.java:107)
>         at jcifs.smb.SmbTree.send(SmbTree.java:92)
...
> 
> I recognized that Windows/DOS error number from seeing it in my C++ test
> app.  It's ERROR_MORE_DATA.  You can see it in PipeTalk if you try to
> echo more than 20 characters (the size of ReceiverThread's char[]).  I
> triggered it with my program because I get back 16-20K of data in a
> single write.  Even when I issue the read with a 64K buffer, it still
> doesn't get it all at once for some reason and trigger's this exception.

I'm having trouble reproducing this Eric. I modfied createnp to send
back a larger amount of data without problems:

[miallen at miallen3 jcifs]$ java -Djcifs.properties=../miallen.prp PipeTalk "smb://miallen2/ipc$/foo"
yoyoyo
yoyoyo
yoyoyoXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX

As you can see prints each chunk of 20 bytes just like the call asks
for. Echoing more than 20 bytes without the createnp.c mod also yields
the expected results:

[miallen at miallen3 jcifs]$ java -Djcifs.properties=../miallen.prp PipeTalk "smb://miallen2/ipc$/foo"
thisstringismuchlongerthantwentybytesinlength
thisstringismuchlongerthantwentybytesinlength
thisstringismuchlong
erthantwentybytesinl
ength

Can you tell me how to modify createnp.c to reproduce this ERROR_MORE_DATA
behaviour? That's definately wrong. The change I made was simply:

static const char *extra = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
...
while(ReadFile(inFile, buf, bufferSize, &bytesRead, NULL) > 0) {
    char out[0xFFF];
    int len = strlen(extra);
    memcpy(out, buf, bytesRead);
    memcpy(out + bytesRead, extra, len);
    WriteFile(outFile, out, bytesRead + len, &bytesRead, NULL);
}

Mike



More information about the jcifs mailing list