Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Verify for drive availability
Message
De
13/02/2009 04:32:08
 
 
À
12/02/2009 20:36:15
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Web
Divers
Thread ID:
01381168
Message ID:
01381522
Vues:
48
This message has been marked as the solution to the initial question of the thread.
>>C# but easily translatable:
bool b = new DriveInfo("C").IsReady;
>
>Yes, this is a common approach. But, I have a UNC and I have to work with something like \\100.100.100.100\MyShareDrive. So, using the UNC approach is a little bit more difficult to detect if the drive is ready. I have seen a lot of approaches to get the UNC from a mapped drive but not vice versa. Also, for now, I am using an approach of verifying if a file exist but that is slow.

If you know the IP address you could ping that with a short timeout. Wouldn't confirm that the drive was ready but....
using System.Net.NetworkInformation;
PingReply response  = new Ping().Send("100.100.100.100", 5);
bool worked = response.Status == IPStatus.Success;
5ms was more than enough on my network,
C# I'm afraid, Regards,
Viv
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform