Solved

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

Posted on 2013-01-19
4
284 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
[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
4 Comments
 
LVL 23

Assisted Solution

by:Michael74
Michael74 earned 130 total points
ID: 38797837
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
ID: 38797967
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
ID: 38800710
>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
ID: 38805850
Thanks to all three of you for some excellent responses.
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

733 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