rcv_buf_size & snd_buf_size

View: New views
4 Messages — Rating Filter:   Alert me  

rcv_buf_size & snd_buf_size

by Stian Brattland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm using WireShark to monitor the smb traffic between my application
(which use JCifs) and a Samba server running on linux. All settings are
the default ones.

When i copy files using windows drag and drop, WireShare reports the
following: Read AndX Request, FID: 0x14fe, 61440 bytes at offset (...).
However, when
i use the JCifs package, WireShare never reports package sizes above
16574. Regardless of wether i change the "jcifs.smb.client.snd_buf_size"
or "jcifs.smb.client.rcv_buf_size", this package size never changes.

I'm using System.setProperty() when i try to alter the buffer sizes.
Have anyone else ever experienced this problem?

Kind regards,
Stian Brattland



Re: rcv_buf_size & snd_buf_size

by Michael B Allen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Oct 7, 2009 at 5:56 AM, Stian Brattland <stian@...> wrote:

> Hi,
>
> I'm using WireShark to monitor the smb traffic between my application (which
> use JCifs) and a Samba server running on linux. All settings are the default
> ones.
>
> When i copy files using windows drag and drop, WireShare reports the
> following: Read AndX Request, FID: 0x14fe, 61440 bytes at offset (...).
> However, when
> i use the JCifs package, WireShare never reports package sizes above 16574.
> Regardless of wether i change the "jcifs.smb.client.snd_buf_size" or
> "jcifs.smb.client.rcv_buf_size", this package size never changes.
>
> I'm using System.setProperty() when i try to alter the buffer sizes. Have
> anyone else ever experienced this problem?

Hi Stian,

What does your JCIFS code look like? Maybe it's not using a larger buffer?

Note that a larger buffer does not equate to faster transfers. The
most important factor is getting as much data into each packet (e.g.
every other packet has 1 byte would be slow).

Mike

--
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/

Parent Message unknown Re: rcv_buf_size & snd_buf_size

by Stian Brattland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Michael,

I have pasted in my testing code below.

package com.tracker.services;

import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileInputStream;

public class CopyTest {

   private static final byte[] buffer  = new byte[60416];
 
   public CopyTest() {
       //I'm setting the client properties here in the constructor.
However, regardless
       //of the values i set here WireShark never reports package sizes
above 16574 bytes.
       System.setProperty("jcifs.smb.client.rcv_buf_size", "60416");
       System.setProperty("jcifs.smb.client.snd_buf_size", "16644");
   }
 
   /**
    * Copy a file from samba server to the local file system.
    *
    * @param   serverPath a path in the format
smb://username:password@.../folders/file
    *          which represents the file on the samba server.
    * @param   localPath an absolute path representing the file on the
local file system.
    * @throws  java.lang.Exception
    */
   public void copyFromServer(String serverPath, String localPath)
throws Exception {
       SmbFile serverFile  = new SmbFile(serverPath);
       File localFile      = new File(localPath);

       InputStream in      = new SmbFileInputStream(serverFile);
       OutputStream out    = new FileOutputStream(localFile);

       try {
           while (true) {
               synchronized (buffer) {
                   int amountRead = in.read(buffer);
                   if (amountRead == -1) {
                       break;
                   }
                   out.write(buffer, 0, amountRead);
               }
           }

       } catch (Exception e) {
           throw e;

       } finally {
           if (in != null) { in.close();}
           if (out != null) {out.close();}
       }
   }
}



Michael B Allen skrev:

> On Wed, Oct 7, 2009 at 5:56 AM, Stian Brattland <stian@...> wrote:
>  
>> Hi,
>>
>> I'm using WireShark to monitor the smb traffic between my application (which
>> use JCifs) and a Samba server running on linux. All settings are the default
>> ones.
>>
>> When i copy files using windows drag and drop, WireShare reports the
>> following: Read AndX Request, FID: 0x14fe, 61440 bytes at offset (...).
>> However, when
>> i use the JCifs package, WireShare never reports package sizes above 16574.
>> Regardless of wether i change the "jcifs.smb.client.snd_buf_size" or
>> "jcifs.smb.client.rcv_buf_size", this package size never changes.
>>
>> I'm using System.setProperty() when i try to alter the buffer sizes. Have
>> anyone else ever experienced this problem?
>>    
>
> Hi Stian,
>
> What does your JCIFS code look like? Maybe it's not using a larger buffer?
>
> Note that a larger buffer does not equate to faster transfers. The
> most important factor is getting as much data into each packet (e.g.
> every other packet has 1 byte would be slow).
>
> Mike
>
>  



Parent Message unknown Re: rcv_buf_size & snd_buf_size

by Michael B Allen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[Please send all messages through the JCIFS mailing list.]

On Thu, Oct 8, 2009 at 4:40 AM, Stian Brattland <stian@...> wrote:
> Hi Michael,
>
> I have pasted in my testing code below.
<snip>

> public class CopyTest {
>
>   private static final byte[] buffer  = new byte[60416];
>     public CopyTest() {
>       //I'm setting the client properties here in the constructor. However,
> regardless
>       //of the values i set here WireShark never reports package sizes above
> 16574 bytes.
>       System.setProperty("jcifs.smb.client.rcv_buf_size", "60416");
>       System.setProperty("jcifs.smb.client.snd_buf_size", "16644");

JCIFS properties are global and static and must be set before JCIFS
classes are loaded. To be sure that your settings are being honored
you must set them in main() or ideally via the
-Djcifs.properties=jcifs.prp commandline option.

Mike

>> On Wed, Oct 7, 2009 at 5:56 AM, Stian Brattland <stian@...>
>> wrote:
>>
>>>
>>> Hi,
>>>
>>> I'm using WireShark to monitor the smb traffic between my application
>>> (which
>>> use JCifs) and a Samba server running on linux. All settings are the
>>> default
>>> ones.
>>>
>>> When i copy files using windows drag and drop, WireShare reports the
>>> following: Read AndX Request, FID: 0x14fe, 61440 bytes at offset (...).
>>> However, when
>>> i use the JCifs package, WireShare never reports package sizes above
>>> 16574.
>>> Regardless of wether i change the "jcifs.smb.client.snd_buf_size" or
>>> "jcifs.smb.client.rcv_buf_size", this package size never changes.
>>>
>>> I'm using System.setProperty() when i try to alter the buffer sizes. Have
>>> anyone else ever experienced this problem?
>>>
>>
>> Hi Stian,
>>
>> What does your JCIFS code look like? Maybe it's not using a larger buffer?
>>
>> Note that a larger buffer does not equate to faster transfers. The
>> most important factor is getting as much data into each packet (e.g.
>> every other packet has 1 byte would be slow).
>>
>> Mike
>>
>>
>



--
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/