Searching for a computer

  • Thread starter Juan Gabriel Del Cid
  • Start date
J

Juan Gabriel Del Cid

I wanna know if a certain computer exists on the
network by giving its name.

Resolve the name. If it throws an exception, it couldn't find it for some
reason:

try {
IPHostEntry hostInfo = Dns.GetHostByName(hostName);
Console.WriteLine(hostInfo.AddressList[0].ToString());
} catch (SocketException exc) {
Console.WriteLine("[Error {0}]: {1}", exc.ErrorCode, exc.Message);
}

Hope that helps,
-JG
 
I

Ing. Leandro Pérez Guió

Hello:

I wanna know if a certain computer exists on the network by giving its name.
How can I do that? Any of you could send me the code?

Greetings
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top