[jcifs] Problem reading multiple writes from named pipe

Michael B.Allen Michael_B_Allen at ml.com
Fri Apr 11 13:12:09 EST 2003

On Thu, 10 Apr 2003 09:38:33 -0400
"Eric Sword" <ericsword at grouplogic.com> wrote:

> switched to just use the regular OutputStream and issuing 2 "real"
> writes to it on the Java side and now the C++ side does not get the 234
> error, though the Java side now is.  
> The main difference between my createnp and yours is that I have 2
> writes:
> 	[snip - read in length and then message using two ReadFile
> calls]
> 	[snip - length of read message is put into length variable]
> 	//write length
> 	returnCode = WriteFile(outFile, &length, sizeof(length),
> &bytesWritten, NULL);

This is not portable. Your Java program will break on a BigEndian machine
like a Sparc.

> 	//echo message
> 	returnCode = WriteFile(outFile, buf, bytesRead, &bytesWritten,
> NULL);
> The secondary difference is that I am running on Windows on both sides
> while you appear to be running on a Unix box judging from your command
> prompt.  I don't know if Windows would exhibit other behavior for some
> reason.

Doesn't matter. JCIFS should behave the same on any platform. But the
behavior might be different depending on which version of Windows you use.

> (I should point out that I used an unmodified PipeTalk to make sure it
> generated the same exception as my other tester program.  It still does
> just one read/write while the modified C++ program did 2 read/writes in
> return.  So the C++ side would get the 234 error in this case, but I put
> in error checking to handle that.)
> Does that help?

Fraid not. I tried 2 write on the createnp side like I originally had
and also tried modifying PipeTalk to write twice. In all cases I never
received the 234 error. Can you send me a modified createnp.c and/or
modified PipeTalk.java with instructions on how to run each program to
reproduce this problem?


More information about the jcifs mailing list