Re[jcifs] connecting to Windows using JCIFS

Michael B Allen miallen at
Fri Apr 25 14:46:47 GMT 2008

On Fri, 25 Apr 2008 00:25:02 -0700 (PDT)
marasim <marasim at> wrote:

> Hi All:
> I am trying to connect to a Windows machine. If the Windows host goes down
> (shuts down, or network disconnects) and then comes back up after a while, I
> get this exception:
> jcifs.smb.SmbException:
> jcifs.util.transport.TransportException
> java.lang.InterruptedException
> and
> jcifs.util.transport.TransportException: Transport1 timedout waiting for
> response to
> SmbComReadAndX[command=SMB_COM_READ_ANDX,received=false,errorCode=0,flags=0x0018,flags2=0xC007,signSeq=6014198,tid=2052,pid=58098,uid=4096,mid=31194,wordCount=12,byteCount=0,andxCommand=0xFF,andxOffset=0,fid=16385,offset=2326739148,maxCount=1024,minCount=1024,openTimeout=-1,remaining=1024,offset=2326739148]

If JCIFS tries to do IO with the server after it goes down you will get
a timeout.

However, JCIFS should recover. Can JCIFS perform RPCs with the target
server after it is back up?

> I have no idea why I get this, I know there is a timeout which I can
> increase, but even after increasing it to 10 minutes instead of the default
> 30 seconds, it doesn't try to reconnect.
> The strange thing is my code doesn't get the exception for me to catch, I am
> using DcerpcHandle and my guess is it calls the SmbTransport.send()
> somewhere which throws this exception.

That exception is coming from the transport thread so it will never be
thrown out to you. It is only logged.

However, the DcerpcHandle should throw it's own exception (timeout
or something like that). At that point the handle is probably invalid
(unlike transports, sessions and trees, internally JCIFS does not hang
onto DcerpcHandles - it only uses them for the operation being performed
and then they're closed).

Just as a matter of style, sleeping and then trying again in a loop
should be logic left to higher level code. For example, if you tried to
do an RPC with a machine that was off, JCIFS would throw that all the
way out to the user. Then they can decide if they want to do something
like sleep for a while and try again.


Michael B Allen
PHP Active Directory SPNEGO SSO

More information about the jcifs mailing list