|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Class Summary | |
Handler | |
Log | Provides logging methods specific to the smb package. |
SmbFile | This class represents a file or directory on an SMB file server. |
SmbFileInputStream | This InputStream can read bytes from a file on an SMB file server. |
SmbFileOutputStream | This OutputStream can write bytes to a file on an SMB file server. |
SmbURLConnection | This class represents a communications link between an application and
an SMB resource represented by a URL . |
This package will enable Java applications to remotely access shared directories on SMB file servers(i.e. Microsoft Windows "shares").
Setting Client Properties
It may be necessary to set various properties for the client to function properly. For example, to connect to a server on a remote subnet the ip address of a nameserver(such as WINS) is required to retrieve the target address.
There are three ways to specify any of the available properties listed below.
1) The traditional System properties are read when the client is first used. This means you can specify an individual property on the command line like:
$ java -Dnameserver=192.168.1.220 MyApp
or set a System property from within your application before any classes of the client are referenced like:
System.getProperties().setProperty( "nameserver", "192.168.1.220" );
2) The jcifs.util.Config
class is used to maintain this information. It can be used directly to set properties before jcifs client classes are referenced like(I think this is probably the easiest way):
jcifs.util.Config.setProperty( "nameserver", "192.168.1.220" );
3) Finally if the property "jcifs.properties" defines the location of a jcifs.util.PropertiesTree
file, all properties will be loaded from it. For example:
$ cat jcifs.prp
nameserver=192.168.1.220
;baddr=192.168.1.255
;log=ALL
$ java -Djcifs.properties=jcifs.prp MyApp
Notice all jcifs client properties have several dot '.' separated components whereas I have chosen only to specify the last label in the examples above. This is perfectly legal. The following:
jcifs.netbios.ns.nameserver
jcifs.netbios.nameserver
jcifs.nameserver
nameserver
are all identical. The more lengthy versions need only be used to avoid namespace conflicts. See the jcifs.util.PropertiesTree
class for more information.
Any properties specified via System properties may be overridden by using the PropertiesTree file which may then be overridden by the Config class.
Available Properties These properties may need to be specified for correct operation |
|
jcifs.smb.client.username | The default username used if not specified in an smb URL |
jcifs.smb.client.password | The default password used if not specified in an smb URL |
jcifs.smb.client.domain | The default authentication domain used if not specified in an smb URL |
jcifs.netbios.ns.nameserver | The ip address of the netbios nameserver such as WINS. This is only required when accessing hosts on different subnets although it is recomended if a nameserver is provided. |
jcifs.netbios.ns.baddr | The local network's broadcast address. It may be necessary to set this for certain network configurations because the default of 255.255.255.255 may otherwise throw a "Network is unreachable" IOException(I have seen this occur when a PPP dialup link is/was in use). For example if the local host's ip address is 192.168.1.15, the broadcast address would likely be 192.168.1.255. |
jcifs.netbios.ns.scope | This is extreemly rare but netbios provides for a "scope" to be used in a attempt to increase the networks name space. Ask your network adminitrator if scope is used. If so it must be set using this property or name queries will fail. |
jcifs.smb.client.laddr | The ip address of the local interface the client should bind to if it is different from the default. For example if the client is to be used over a dial-up connection the ip address of the PPP interface may need to be specified with this property. |
jcifs.netbios.ns.laddr | The ip address of the local interface the client should bind to for name queries if it is different from the default. |
Less Commonly Used Properties None of these properties are required for the client to function | |
jcifs.util.log | A series of string identifiers to induce log messages to be printed to the console such as log=EXC,DEB,WAR,HEX would log internal exceptions, debugging, warngings, and hex dumps of network packets. ALL may be specified to indicate all messages should be logged. The ALL argument will produce more messages than EXC,DEB,WAR,HEX combined. |
jcifs.smb.client.responseTimeout | The time period in milliseconds that the client will wait for a response to a request from the server. The default value is 10000. Under poor network conditions you may wish to increase this value but jcifs.smb.client.soTimeout should be increased as well to accommodate. |
jcifs.netbios.ns.cachePolicy | When a netbios name is resolved with the NbtAddress class it is cached to reduce redundant name queries. This property controls how long, in seconds, these names are cached. The default is 30 seconds, 0 is no caching, and -1 is forever. |
jcifs.netbios.ns.hostname | In the course of standard operations the client must present a netbios name to the server. This is dynamically generated(e.g. JCIFS35_177_E6) but if logged by the server one may wish to explicitly set this name(e.g. PROD_FEED3) for server accounting purposes. |
jcifs.smb.client.listSize | One command that may be individually tuned is the TRANS2_FIND_FIRST/NEXT2 operation. It is provoked by the list() method of SmbFile. The size of the data buffer used, in bytes, can be set with this property. The default size is 800 bytes. |
jcifs.smb.client.soTimeout | To prevent the client from holding server resources unnecessarily, sockets are closed after this time period which is specified in milliseconds. The default is 15000. |
jcifs.smb.client.lport | If a particular local port must be used for socket communications, perhaps because a firewall requires the source port to be a specific value, it can be set with this property(e.g. port=5139). This has no effect on the remote port which is invariably 139. |
jcifs.netbios.ns.soTimeout | To prevent the client from holding resources unnecessarily, the datagram socket used for nameservice queries is closed after this time period which is specified in milliseconds. The default is 5000. |
jcifs.netbios.ns.lport | If a particular local port must be used for socket communications, perhaps because a firewall requires the source port to be a specific value, it can be set with this property(e.g. port=5137). This has no effect on the remote port which is invariably 137. |
jcifs.netbios.ns.retryCount | The number of times a name query should be attempted if no answer is received. In adverse network conditions one may wish to increase this value however failed name querys take retryCount * retryDuration milliseconds. The default value is 2. Should probably increase jcifs.netbios.ns.retryTimeout instead. |
jcifs.netbios.ns.retryTimeout | The duration in milliseconds that the client will wait for a response to a name query. The default is 3000. |
Advanced Properties These should not be changed | |
jcifs.smb.client.nativeOs | Specifies the NativeOS field in the SMB_COM_SESSION_SETUP_ANDX command. The default is the os.name system property. |
jcifs.smb.client.nativeLanMan | Specifies the NativeLanMan field in the SMB_COM_SESSION_SETUP_ANDX request. The default is "foo". |
jcifs.smb.client.maxMpxCount | This client can send and receive messages concurrently. The number of simultanious outstanding transactions with a given server is controlled by this property. The default is 10. If _many_ operations are performed on the same server this value may need to be adjusted to achive optimal throughput. |
jcifs.smb.client.useNTSmbs | Currently I have not tweeked the dozens of undocumented flags and fields necessary to support SMB_COM_NT_CREATE_ANDX and for that reason this property is false by default. |
jcifs.smb.client.useUnicode | This client will use Unicode strings wherever negotiated. Setting this property to false will remove Unicode capability and therefore use only ASCII strings. |
jcifs.netbios.client.writeSize | The size of buffer in bytes that the netbios Socket layer uses to write data to the raw socket. The default is 1500. In effect this is the session service message size. |
jcifs.smb.client.flags2 | A carefully crafted integer may be used with this property to specify the flags2 field of the smb header. |
jcifs.smb.client.capabilities | A carefully crafted integer may be used with this property to specify the capabilities field of the SMB_COM_SESSION_SETUP_ANDX command. |
jcifs.smb.client.rcv_buf_size | One buffer is used to decode incoming packets. The size of this buffer may be specified, in bytes, using this property. |
jcifs.smb.client.snd_buf_size | One buffer is used to encode outgoing packets. The size of this buffer may be specified, in bytes, using this property. DANGER: SET THIS TO > MTU IF YOU WANT PERFORMANCE TO SUCK |
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |