[jcifs] Disconnect from a share

Mathias Dietz MDIETZ at de.ibm.com
Fri Aug 12 12:23:41 GMT 2005


Michael B Allen <mba2000 at ioplex.com> wrote on 08/11/2005 08:32:27 PM:

> This error should not occur with a reasonable soTimeout value. I think
> you might be setting soTimeout too low.

I've used the default value , but error occurs also with
jcifs.Config.setProperty("jcifs.smb.client.soTimeout", "15000");


> That's what soTimeout does. When the transport is idle for longer than
> jcifs.smb.client.soTimeout jCIFS will transmit the appropriate loggoff
> and disconnect messages and then close the underlying socket. This should
> not generate an error on the server or the client.

Yes, you are right.I had overlooked it.But the error in the server log
(samba 3.0.14a)
still occurs.

After some debugging (comparing tcp packages from smbclient with jcifs), I
found two causes for the "Broken Pipe" error.

1) doDisconnect() sends a LogoffAndX packet and doesn't wait for the
response.
   This causes a server error message (Error writing xx bytes to client).
   Solution: In SMBSession.logoff(boolean) replace
       transport.send( request, null );
      with
       transport.send( request, new SmbComLogoffAndX(null));

2) The Java VM sends a TCP RST package when you close the socket, smbclient
sends a TCP FIN package.
   I found a description of the problem here:
   http://java.sun.com/security/javaone/2003/2240-Networking.pdf
   Solution: In SMBTransport.doDisconnect(..) add:
            socket.shutdownOutput();
   above of ->
            out.close();
            in.close();

I'm still very interessted in a disconnect() method , because I use jcifs
to monitor multiple samba servers (up to 100).
And I must create a new connection each 10-15 seconds.A disconnect() method
would help to save a lot of
resources (# of threads) und would make life easier.


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/



More information about the jcifs mailing list