[jcifs] problem with TransactNamedPipeInputStream

sharath reddy sharathreddy at yahoo.com
Fri Sep 27 05:48:06 EST 2002

Hi Michael,

I was experimenting with some DCE/RPC stuff and I ran
across the following problem:

I'm using named pipes and ran into a problem when I do
consecutive reads from TransactNamedPipeInputStream.
Here's what (i think) happens:

The first time I read data from the pipe, I retrieve
68 bytes of data from the pipe. This sets the value
of the variables: beg_idx = nxt_idx = 68.

The next time data is being written into the pipe (via
the 'receive' funtion), turns out the buffer is too
small. So a new, larger  buffer is created, and the
data is copied over from the old buffer into the new:

System.arraycopy( tmp, beg_idx, pipe_buf, 0, used );
beg_idx = 0;

However, when I do another read from the pipe, I seem
to have 68 bytes of zeros, then my data. The last
68 bytes of my data is missing. 

I was able to fix this by adding the following line:
nxt_idx -= beg_idx;

before setting beg_idx to zero, after resizing the

Please let me know if I am missing something.
BTW, your method 'Log.printHexDump' is very cool!


Sharath Reddy
Cell : 512 689 4360

Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!

More information about the jcifs mailing list