Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an app that needs to regularly (1 sec) read a file across the network. Occasionally, the network fails me, and the app can't read the file. Problem is, the app hangs for a very long time each time this occurs, meaning it becomes unusable.

It's actually not important if this read fails occasionally. How can I reduce the timeout when I read from the file? The file is read using a Delphi 2006 FileStream. The target hardware is Win XP and 7.

share|improve this question
    
You have two basic choices: You can read from the file in a thread or you can use overlapped I/O. –  David Schwartz May 13 '12 at 23:46
    
Thanks @David. In this application it would be preferable to timeout after 1 sec (say) and move on and let the application continue with other more important things, hence my wanting to know about reducing the timeout. I gather if I used overlapped I/O I could continue as soon as I had started the read, but do you know if it is possible to get at the internals of Delphi file I/O at that level - or would I do it myself with WinAPI stuff? –  rossmcm May 14 '12 at 2:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.