logo       

Batching command in CIFS: msg#00105

network.samba.java

Subject: Batching command in CIFS

All,

I am trying to use the "batching command" features of jCIFS library. I
wish to control which SMB commands to be batched together as it is
said in the document.

However , it seems that the commands is not controlled ! I can
seperate the default batched command such as "SessionSetupAndX and
TreeConnectAndX " by setting
jcifs.smb.client.SessionSetupAndX.TreeConnectAndX = 0. But, other
setting doesn't help to combine the command.

Does any body have any idea about this?

This is my code . Very simple and straight forward.
=========================================

import jcifs.smb.*;
import java.io.*;
import jcifs.Config;
import java.util.*;

public class Batching {

public static void main( String argv[] ) throws Exception {

Config.setProperty( "jcifs.smb.client.useBatching","true");

Config.setProperty(
"jcifs.smb.client.SessionSetupAndX.TreeConnectAndX", "1" );
Config.setProperty(
"jcifs.smb.client.TreeConnectAndX.CheckDirectory", "1" );
Config.setProperty(
"jcifs.smb.client.TreeConnectAndX.CreateDirectory", "1" );
Config.setProperty( "jcifs.smb.client.TreeConnectAndX.Delete", "1" );
Config.setProperty(
"jcifs.smb.client.TreeConnectAndX.DeleteDirectory", "1" );
Config.setProperty( "jcifs.smb.client.TreeConnectAndX.OpenAndX", "1" );
Config.setProperty( "jcifs.smb.client.TreeConnectAndX.Rename", "1" );
Config.setProperty(
"jcifs.smb.client.TreeConnectAndX.Transaction", "1" );
Config.setProperty(
"jcifs.smb.client.TreeConnectAndX.QueryInformation", "1" );
Config.setProperty( "jcifs.smb.client.OpenAndX.ReadAndX ", "1" );
Config.setProperty( "jcifs.smb.client.NTCreateAndX.ReadAndX", "1" );
Config.setProperty( "jcifs.smb.client.ReadAndX.Close", "1" );
Config.setProperty( "jcifs.smb.client.WriteAndX.Close", "1" );
Config.setProperty( "jcifs.smb.client.WriteAndX.ReadAndX", "1" );
Config.setProperty( "jcifs.smb.client.WriteAndX.Close", "1" );


//copy to CIFS server
if (argv[1].startsWith("SMB://")){
SmbFile from = new SmbFile( argv[0] );
SmbFile to = new SmbFile( argv[1] );
from.copyTo( to );

//copy to local
} else {
SmbFileInputStream si = new SmbFileInputStream ( argv[0] );
FileOutputStream fo = new FileOutputStream ( argv[1] );

byte[] b = new byte[1024];
int n, tot = 0;
while(( n = si.read( b )) > 0 ) {
fo.write(b);
tot += n;
}
si.close();
fo.close();
System.out.println(tot+" bytes copied");
}

}
}



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise