[jcifs] Re: Disconnect from a share

Alex asaupp at web.de
Wed Oct 19 19:25:35 GMT 2005

Levi Purvis <mail <at> levipurvis.com> writes:
> I'm not very familiar with the internals of the JCIFS code, but in
> general it is fairly easy to create a dedicated "logoff" thread to fix
> this problem.  Rather than rudely closing the socket, execute the code
> for reading the "logoff" response and closing the socket on a separate
> thread.  This way the rest of the code doesn't have to wait, but the
> other end won't get the "Connection reset by peer" problem.  You may
> only need one thread to act as a "sink" for cleaning up, so
> performance should be comparable to the current code.  Throw in NIO,
> and it will be even better.    A thread pool might be in order if
> many concurrent logoff responses are expected and NIO is not an
> option, to avoid having sockets that need closing pile up.

Thanks for racking my brains :-)

Would you have some details on the 'logoff thread' you propose? How would i

The main point I am trying to be strict is that i want to be sure the 
first session (samba service check) is really closed on server side before 
i run the second service type (check) - having a seperate thread doing the 
logoff doesn't sound like the approach giving a guaranteed close confirmation
to me?

Bye, Alex

More information about the jcifs mailing list