Discuss (FTP), (FTP on .NET CF) and (FTPS, SFTP and SCP).

Concurrency Issue

no avatar
User

quimbo

Posts

30

Joined

Sat Aug 25, 2007 2:59 am

Concurrency Issue

by quimbo » Fri Nov 12, 2010 8:42 am

I have a SFTP server that clients connect to and upload files. (small files 1300 to 10000 bytes)

I have a process that connects to the server and moves the files.

I get a list of files:

filesToLoad = sFTP.GetFileInfos(resultFolder & "\*.hl7")

Occasionally the second process moves a file while it is still being uploaded and I end up moving 0 bytes.

Is there anyway in the edtFTPnet/PRO library to know that a file is still being uploaded?

Thank you.
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: Concurrency Issue

by support2 » Fri Nov 12, 2010 10:20 am

The client can't easily detect this (unless you know how large the files are, and you get the size before downloading).

The best solution is for the uploading clients to upload to a temp file, and then to do a rename at the end of the upload. If you filter out temp files in your listing then you'll only get files that are completely uploaded.
no avatar
User

quimbo

Posts

30

Joined

Sat Aug 25, 2007 2:59 am

by quimbo » Tue Nov 16, 2010 1:51 am

Thank you. I have control over about 65 percent of the client connections. I will update that application to do the rename scenario you outlined
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Tue Nov 16, 2010 7:23 am

Another option is to get the size before downloading, wait say 5 sec, and then get the size again. If the size is identical, you can assume that it still isn't being written to. This should work 99% of the time.

Who is online

Users browsing this forum: No registered users and 19 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron