Solved

Get/Put file To/From FTP server

Posted on 2004-09-21
5
265 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

729 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