Mantorok,
If you want to ping the machine, then I would actually try to ping the
machine then. You should be able to resolve the IP, and then just ping
normally (like you would any other network host). You can use the libraries
at the indy project to do this.
However, this assumes that the machines are servicing ping requests.
As for having access, you might have access to certain things on the
machine, but whatever it is on that machine you want to access, you don't
have access to (assuming that you can reach the machine).
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Mantorok said:
Nicholas
I would use the Directory.Exists but it takes around 2 mins if the pc is
not
connected, which is unacceptable.
The access-denied error is also incorrect, as I do have access to it.
Kev
in
message news:
[email protected]...
Mantorok,
Why not just try and open the share up? You can check for the existence
through the Exists methods on the DirectoryInfo and Directory classes.
And if you get an access denied error, then it means that you shouldn't
be trying to get to that share in the first place.
The first task would be to see if you have access to the path you
want
to access. If you don't, then everything else is moot.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Hi Dennis
That appeared promising but fails with the the message "Access to the path
is denied", I'm trying to check if another pc on the network is
available,
basically checking the \\pcname\c$ share.
I do have access to the machine as I can browse to the shaire, however,
WebRequest failes with that exception message.
Any ideas?
You could perform a request and check whether you get anything back.
public static bool Ping ( string url )
{
WebRequest r = WebRequest.Create(url);
try
{
r.GetResponse();
return true;
}
catch
{
}
return false;
}
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
Hi all
I want to ping an ipaddress/host to check for a response.
Is there any easy way in C#/.Net to do this?
Thanks
Kev