Solved

Get/Put file To/From FTP server

Posted on 2004-09-21
5
245 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending a email via excel using vba 6 82
VB6 - Compare and highlight cell not the same 3 51
vb6 connector to mongodb 2 84
TT Auto Dashboard 13 92
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

810 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