Copy files from server to client

Forums for specific tips, techniques and example code
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Copy files from server to client

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:44 pm

by Mike >> Wed, 6 Aug 2003 1:17:46 GMT

Does anyone know how to copy files located on a directory on the server to a directory on a client without any using shared directories?
G

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Copy files from server to client

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:44 pm

by Allistar Melville >> Wed, 6 Aug 2003 2:36:48 GMT

Hi Mike,
You could break the file into chunks (say 2kb in size) and use successive serveExecution/clientExecution methods to transfer the data (as a Binary) to a file on the client. The nice thing about this is that you can implemetn a progress bar, but there will be some extra overhead as transients are moved between client and server.

Another way is to us a TcpIpConnection object and get the client to listen to a particular port which the server (via a serverExecution method or a server application) streams data to the client computer which it then sticks in a file. There may be a bit of work involved ni doing this though.

There are probably other way of achieving this but there are a couple.

Regards,
Allistar.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Copy files from server to client

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:44 pm

by Mike >> Wed, 6 Aug 2003 5:33:35 GMT

Hi Allister,

Thanks for your fast response. The files in question are Microsoft database files and are at least 15mb in size. Do you know any alternative method for files of this size?

Regards,

Mike

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Copy files from server to client

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:44 pm

by allistar >> Wed, 6 Aug 2003 9:06:17 GMT

Hi Mike,
A simple approach is to store the 15Mb file as a binary in the database and then get the client to save it to disk. That would be easy to code but whether it is the most efficient approach is another question. It would pay to compress the file(s) first (if they compress well).

Regards,
Allistar.

------------------------------------------------------------------
Allistar Melville
Software Developer, Analyst allistar@silvermoon.co.nz
Auckland, NEW ZEALAND

Silvermoon Software
Specialising in JADE development and consulting
Visit us at: http://www.silvermoon.co.nz
*NEW* Simple web access to Jade at: www.silvermoon.co.nz/jhp.html ------------------------------------------------------------------

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Copy files from server to client

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:44 pm

by johnmunro >> Wed, 6 Aug 2003 10:30:21 GMT

We do pretty much what Allistar suggested - open the source file with usePresentationFileSystem set to false and the destination with it set to true, then just loop a chunk of file at a time doing this:

fileDest.writeBinary(fileSource.readBinary(iBufferLength));

The optimal size of the chunks you read/write in will depend mostly on the speed of your connection, and trial&error seems to be the only way to work it out.

--
John Munro

Synergist Limited - Home of FileVision(TM)
The Bioscience Innovation Centre
Cowley Road, Cambridge, UK
CB4 0DS
Telephone: +44 (0) 1223 478200
Fax: +44 (0) 1223 477969
Email: john.munro@filevision.com
Web: http://www.filevision.com

The contents of this communication are confidential and are only intended to be read by the addressee. We apologize if you receive this communication in error and ask that you contact Synergist Limited immediately to arrange for its return. The use of any information contained in this communication by an unauthorized person is strictly prohibited. Synergist Limited cannot accept responsibility for the accuracy or completeness of this communication as it is being transmitted over a public network. If you suspect this message may have been intercepted or amended, please inform Synergist Limited.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Copy files from server to client

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:44 pm

by cnwrwm1 >> Thu, 7 Aug 2003 1:00:10 GMT

We use the same technique in the JADECare Systems Manager, doing binary reads of about 64K chunks at a time, transferring from presentation client to server. This seems to be fairly efficient between the presentation client and the app server because we leave the automatic compression switched on.

Cheers

Richard


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 15 guests