I have a webservice which takes a hostname and drive letter as input and
returns the free space for that drive on that host as a long. Sometimes
it will take forever to get information from a recalcitrant host, but it
keeps trying far longer than I want it to. How can I set up a timeout
for the process, so that after a couple of seconds it returns a failure
status and gives up waiting?
Currently, the method maps the drive, finds its available space, and
then unmaps it, which all works quite neatly. If the host doesn't exist
or the drive doesn't exist it returns -1. Otherwise it returns the free
space in bytes as a long. We're currently experiencing network
difficulties because of a relocation. Most of our important business
systems, including DNS servers and the like, are now about 10 miles away
and are accessed via a much, much slower link than we're used to. Some
hosts simply take ages to respond and I'd like to impose a timeout
somehow. I thought maybe some sort of timer based arrangement might
work, but now that I'm trying it I can't actually work out what needs to
be done.
Any help would be appreciated.
*** Sent via Developersdex http://www.developersdex.com ***