[jcifs] SmbException by copying a File

Kai Kuhn kku at shd.de
Thu Sep 1 05:37:29 GMT 2005


Michael B Allen schrieb:

>On Mon, 29 Aug 2005 21:19:06 +0200
>"kku at shd.de" <kku at shd.de> wrote:
>
>  
>
>>Hi,
>>
>>I try to copy a File (Zip-File) from an SMB share on a Windows 2003 
>>Server (SP1) to an other 2003 Server.
>>Sometimes it works great, but often the transmission crashes with an 
>>Exception:
>>
>>jcifs.smb.SmbException:
>>jcifs.util.transport.TransportException: Transport1 timedout waiting for 
>>respons
>>e to 
>>SmbComReadAndX[command=SMB_COM_READ_ANDX,received=false,errorCode=The opera
>>tion completed 
>>successfully.,flags=0x0018,flags2=0xC003,signSeq=0,tid=12289,pid=
>>52551,uid=20482,mid=2537,wordCount=12,byteCount=0,andxCommand=0xFF,andxOffset=0, 
>>
>>fid=16392,offset=4030464,maxCount=2048,minCount=2048,openTimeout=-1,remaining=0, 
>>
>>offset=4030464]
>>       at jcifs.util.transport.Transport.sendrecv(Transport.java:74)
>>       at jcifs.smb.SmbTransport.send(SmbTransport.java:554)
>>       at jcifs.smb.SmbSession.send(SmbSession.java:228)
>>       at jcifs.smb.SmbTree.send(SmbTree.java:102)
>>       at jcifs.smb.SmbFile.send(SmbFile.java:688)
>>       at jcifs.smb.SmbFileInputStream.read(SmbFileInputStream.java:152)
>>
>>The connection between the 2 Servers is available at all the time and 
>>doesn't break.
>>Copying the File whit the Windows-Explorer or other tools works whitout 
>>problems.
>>
>>What can I do?
>>    
>>
>
>Try setting jcifs.smb.client.responseTimeout = 300000. This will cause
>the client to wait for up to 5 minutes for a response. The default value
>is 10 seconds. If you still get the error then there's something else
>going wrong and we'll need to start talking about packet captures. If it
>"fixes" the problem then you might want to look at your network.
>
>Mike
>  
>
Thank you

I tryed it, but had no succes.
Most Times the transfer breaks when I copy over an ISDN Connection.
Whit the old Version 0.8.1 I had no problems.

I do it this way - is it correct?:

*System*.setProperty( "jcifs.smb.client.responseTimeout", "300000" );

FileUtil.copyFile(*new* SmbFileInputStream(fileNameFile), *new* *FileOutputStream*(targetFile));


 */***
*    * Kopiert eine Datei von A nach B*
*    **
*    * **@param */sourceStream //das zu kopierende File/
/    /***/ /*@param */targetStream //die Zieldatei/
/    /***/ /*@throws */IOException/
/    /**/*
   *public* static void copyFile(*InputStream* sourceStream, *OutputStream* targetStream) *throws* *IOException*
   {
      byte[] byteBuffer = *new* byte[2 * 1024];
      int count = 0;
      *do*
      {
         targetStream.write(byteBuffer, 0, count);
         count = sourceStream.read(byteBuffer, 0, byteBuffer.length);
      }
      *while* (count != -1);
      sourceStream.close();
      targetStream.flush();
      targetStream.close();
   }

thanks Kai
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the jcifs mailing list