session.downloadFile

Using ScreenScraper 2.6 professional edition.

Observing the following behavior.

Trying to figure out why I can use (session.downloadFile + File.renameTo) to (download a file locally + move to a networked storage device) in 6 seconds grand total, but doing session.downloadFile on exact same file to exact same networked storage device takes 12 minutes.

What is session.downloadFile doing under the covers that might behave differently when writing locally vs remotely? (I don't *think* it is an issue with my connection to the networked storage because the file can be moved there in 1 second).

Any ideas?

// download file to local drive
// takes about 5 seconds for 2MB file
session.downloadFile( downloadUrl, "C:\\myFileName");

// move that file from local to nonlocal drive
// takes about 1 second for 2MB file
File source = new File("C:\\myFileName");
source.renameTo(new File("\\\\ip\\mydrive\\myFileName"));

// instead of 2 step process, try downloading file directly to the nonlocal drive
// takes 12 minutes for 2MB file
session.downloadFile( downloadUrl, "\\\\ip\\mydrive\\myFileName");

bwise, It's hard to say why

bwise,

It's hard to say why it takes so much longer for screen-scraper to save the file over the network vs. directly to your file system.

What is the make up of the client machine and the destination computer (different file systems)? What is the setup of your network (firewall, or other security in place)?

Internally we are using the following code to handle the buffering and copying of the bytes to their destination.

                        byte[] outputBuffer = null;
                        byte[] tmpBuffer = null;
                        int bufferLength = 4096;       
                        int len = 0;

      InputStream inputStream = new BufferedInputStream( httpResponse.getEntity().getContent() );
                        outputBuffer = new byte[bufferLength];

      FileOutputStream out = new FileOutputStream( fileName );

while( ( len = inputStream.read( outputBuffer, 0, bufferLength ) )!=-1 )
                        {
                                tmpBuffer = new byte[len];

                                System.arraycopy( outputBuffer, 0, tmpBuffer, 0, len );

                                out.write( tmpBuffer );
                        }
out.close();

HTTPClient handles the stream from the target server. The buffer lengths are 4096k.

I'm not an expert on networking but one thought comes to mind. Depending on what kind of network you're on would it make sense to elevate the permissions of the user that is executing screen-scraper? Because screen-scraper is the one writing to the network drive perhaps it is being given the once over more than a few times for every buffer chunk it tries to write.

Just a thought.
-Scott