Solved

C# - Looking for some code to wait for a for an external process

Posted on 2013-01-19
4
270 Views
Last Modified: 2013-01-22
I'm developing an app that requests data from an external Oracle DB via a WAN connection. The Oracle DB is SLOW to return the data. Depending on the data being requested, the response time varies from 3 minutes to 20 minutes. Here's an algorithm I'm planning on developing. I need suggestions with Step 3

Step 1 - Delete the local copy of the previous Oracle export file (tab-delimited).
Step 2 - Send request to Oracle server for new file (using BAT/CMD file combo).
Step 3 - Wait for 60 seconds.
Step 4 - Check for the presence of the new export file.
Step 5 - Is the file there? Advance to Step 6. If not, return to step 3.
Step 6 - Import the file.
0
Comment
Question by:jdana
4 Comments
 
LVL 23

Assisted Solution

by:Michael74
Michael74 earned 130 total points
Comment Utility
The following will cause the application to wait for 60 seconds

System.Threading.Thread.Sleep(60000);

Michael
0
 
LVL 13

Assisted Solution

by:Naman Goel
Naman Goel earned 130 total points
Comment Utility
Yes, Thread.Sleep will stop the executing thread for given amount of time. However if you want remain responsive (UI doesn't freeze) you might consider timers.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 130 total points
Comment Utility
>Step 4 - Check for the presence of the new export file.

Given that you are waiting for a file to be created, instead of using timers or making threads sleep, you can use the FileSystemWatcher object to monitor the folder and when the file arrives, your code will be triggered automatically so you can import the file


http://www.codeproject.com/Articles/3192/Watching-Folder-Activity-in-VB-NET

http://www.blackwasp.co.uk/FileSystemWatcher.aspx
0
 

Author Closing Comment

by:jdana
Comment Utility
Thanks to all three of you for some excellent responses.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 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

7 Experts available now in Live!

Get 1:1 Help Now