[jcifs] problem with TransactNamedPipeInputStream

Allen, Michael B (RSCH) Michael_B_Allen at ml.com
Fri Sep 27 08:55:11 EST 2002


> -----Original Message-----
> From:	sharath reddy [SMTP:sharathreddy at yahoo.com]
> Sent:	Thursday, September 26, 2002 3:48 PM
> To:	jcifs at lists.samba.org
> Subject:	[jcifs] problem with TransactNamedPipeInputStream
> 
> 
> 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;
> 
	It's been a while since I looked at that code. If it works just run with it.
	Concentrate on the DCE/RPC aspect. If something is really broken then
	let me know and I fix it. Don't kludge your code to get around problems
	with mine. That will just create more work for both of us.

> before setting beg_idx to zero, after resizing the
> buffer.
> 
> Please let me know if I am missing something.
> BTW, your method 'Log.printHexDump' is very cool!
> 
	I think that was the first jCIFS method ever written. By Chris actually.

> Regards,
> Sharath
> 
> 
> =====
> Sharath Reddy
> Cell : 512 689 4360
> 
> __________________________________________________
> Do you Yahoo!?
> New DSL Internet Access from SBC & Yahoo!
> http://sbc.yahoo.com




More information about the jcifs mailing list