Solved

Get/Put file To/From FTP server

Posted on 2004-09-21
5
226 Views
Last Modified: 2010-05-02
Dear All,

I have two windwo applications A & B running on different PCs.

Application A: put a file to FTP server.
Application B: get this file FTP server.

How can I prevent Application B to get a file which is being uploaded to FTP server by Application A?

I think uploading a dummy file may be useful. Any good idea?

Thanks!
0
Comment
Question by:cplau
5 Comments
 

Author Comment

by:cplau
ID: 12111959
In getting a file, can I check this file is being modified by someone else?
0
 
LVL 4

Accepted Solution

by:
Glowman earned 125 total points
ID: 12112058
Cplau,
What I do is do a loose loop checking file size every few seconds depending on the connection rate use InternetFindNextFile to loop through the files in the FTP directory, and then using the WIN32_FIND_DATA to determine if the nFileSizeLow has changed, if it hasn't after a try or two the file up there is done being uploaded.  There must be a way to tell if the file is in a change state but I couldn't figure it out so I did it this way.  Got more code if you want it.
G
0
 
LVL 5

Expert Comment

by:abith
ID: 12112314
hi
there is a one way.  keep a index file in which weather the new has been upload completely or not.

Assume that if the A application is sending the file before sending the file create a file in the A server and set a flag to 0.  after completion set the flag to 1.

And b applicaiton can open the application and check the status.  and if the get is done the line can be deleted.

Else you have to go for the port connection method,

Regards
Abith
0
 
LVL 14

Expert Comment

by:aelatik
ID: 12112605
You could PUT the file starting with a special character like "~FILENAME.BIN".
When finished rename the file to "FILENAME.BIN"

And in your GET program don't dowload files starting with "~"
0
 
LVL 14

Expert Comment

by:aelatik
ID: 12112650
Or in your GET program, do a rename test before downloading to test if the file is in use. for example :

RENAME FILENAME.EXE TESTFILENAME.EXE
 ' Check if error occurs, if not RENAME it back and dowload
RENAME TESTFILENAME.EXE FILENAME.EXE
GET FILENAME.EXE C:\FILENAME.EXE
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now