Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best way to exit application when host fails to respond?

Status
Not open for further replies.

ant1111

Programmer
Sep 16, 2004
3
US
I have this codes in my VB.Net application:

screenHost.SendKeys ("<Enter>")
Do While screenhost.OIA.Xstatus <> 0
Loop

But when the host (that my application is connected to) does not respond, it caused my application hang.

What is the best way to exit my application gracefullly when the host fails to respond?

Should I put DoEvents inside the loop?

Thanks
 
The host always responds at some point.

I always put a DoEvents in the loop to not keep the app from "hanging" while it's waiting for a response.

calculus
 
calculus,

Thanks for your prompt response.

I have an Windows service (FileSystemWatcher) that looks for data being dropped to the watcher folder and launches my VB console application that connected to host application via Extra.exe. Sometimes my VB application and host response are out of sync, thus cause both Extra.exe and my VB application hang. When I kill Extra.exe (via Task Manager), it free my application.

I appreciate your thought and feedback on this.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top