[jcifs] Disconnect from a share

Mathias Dietz MDIETZ at de.ibm.com
Thu Aug 11 14:05:15 GMT 2005

there is no way to make a clean disconnect from a share after doing some
stuff .

System.out.println("CONNECT TO: smb://" + ip + "/smb_control/");
SmbFile smb =new SmbFile("smb://;:@" + ip+ "/smb_control/");
String[] sm = smb.list();
System.out.println("Finished !");
//here close the SMBSession , Transport

The only way to disconnect, seems to be the socket timeout (
jcifs.smb.client.soTimeout) but
this generates ugly error messages on the server :
Aug 11 15:30:17 back1 smbd[30618]:   write_socket: Error writing 43 bytes
to socket 26: ERRNO = Broken pipe

I would prefer a disconnect() method in SmbFile which does something like:
   * Disconnect from server.
   * WARNING! Closes the SMBTransport and all active SMBSession's.
   * Should only be called if no other SMBSession is alive or required.
   *  @param boolean hard ,  If false close only if no active request is
   public void disconnect(boolean hard){

or a transport_idle_timeout , which makes a clean disconnect before closing
the socket.

@Michael: Would you kindly implement such a function , or do you accept a
patch ?

mit freundlichen Grüßen / best regards

Mathias Dietz

Software Development                              Dept. A182
IBM Deutschland GmbH
Hechtsheimer Strasse 2  Geb.83
D-55131 Mainz
Phone (+49)-6131-84-2027
Fax (+49)-6131-84-3111
E-Mail : MDietz at de.ibm.com
IBM Certified Professional Server Specialist
Visit Open Enterprise System Virtualization:
IBM intranet ---> http://w3.ais.mainz.de.ibm.com/stonehenge/
Internet ---> http://www-5.ibm.com/services/de/its/filestore.html

More information about the jcifs mailing list