Re[jcifs] ading files using SmbFileInputStream
avivf at mailinator.com
Mon Jun 15 15:01:07 GMT 2009
Hello, I've been using jcifs for quite (version 1.3.9) a while and must say
I'm impressed. However, I've noticed that transferring files from my server
to my local machine takes a very long time. Here is the code I use to
transfer the file:
InputStream in = new SmbFileInputStream(remoteFile);
OutputStream out = new FileOutputStream(localFile);
byte buffer = new byte;
int read = 0;
while ((read = in.read(buffer) > 0)
out.write(buffer, 0, read);
Now, this can take about 40 seconds for a 1.2MB file. When copying the file
using Windows Explorer, however, it only takes about 10 seconds. I decided
to try and find out what the difference was. Using Wireshark I noticed that
in the ReadAndXRequests issued from Windows Explorer each read was 61440
bytes of length, while those issued from jcifs were 4356 bytes consistently.
Upon further investigation, I saw that in SmbFileInputStream the requests
are sent with a maximal length of transport.server.maxBufferSize, which
apparently in my case is 4356. I've tried changing the
jcifs.smb.client.rcv_buf_size but since the request sizes are bound to
server.maxBufferSize, it didn't help.
To sum it up, why would the maxBufferSize be different for jcifs as opposed
to Windows Explorer? Is it possible to take maxBufferSize as a
recommendation and send requests with larger sizes?
Thanks in advance,
View this message in context: http://www.nabble.com/Reading-files-using-SmbFileInputStream-tp24036224p24036224.html
Sent from the Samba - jcifs mailing list archive at Nabble.com.
More information about the jcifs