• Post Reply Bookmark Topic Watch Topic
  • New Topic

FileReader TimeOut help  RSS feed

 
Liwuen Chew
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone! I hope someone can help me!

I'm working in an application which needs to read a txt file over the network (is an application running in a client and the file is in a server). I noticed that, when I'm having network problems, the application hangs and I get the gray window.
Checking about this I found that the problem was because of a FileReader that was looking for the file while disconnected from the network. Is there any way to set up de FileReader's timeout, so it lasts no more than 4 seconds?

Thank you so much!
 
Andrey Kozhanov
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

I could think of the only way to add pause to FileReader - to create separate thread, which will watch reading time and report timeouts. For example, like this (for simplicity i overrode only read() method):

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!