Possible Duplicates:
Speed up File.Exists for non existing network shares
Faster DirectoryExists function?
We need to write text to a file on our network, but there may be a situation where that location does not exist and we need to write to another location instead. How do you check quickly that a network location exists? Attempting to write text to a location that does not exist using a 'try...except' takes a whopping 30 seconds(ish). There must be a faster way, surely?
I'd be very grateful if someone could give me some pointers please.
Thanks!
For those of you interested in the answer for a Delphi context, I used the Indy component IdIcmpClient component to ping the IP, as follows:
IdIcmpClient1.Host:= '10.0.0.999';
try
IdIcmpClient1.Ping();
except
showmessage('Not found');
end;
You get a result in just over 3 seconds if it is not there, or almost instantly if it is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With