[LEFT]include "stdafx.h"
using namespace System;
using namespace System::Net;
using namespace System::Net::Sockets;
void PrintHostInfo(String host) {
try {
IPHostEntry hostInfo;
hostInfo = Dns::Resolve(host);
Console::WriteLine("tCanonical Name: " + hostInfo->HostName);
Console::Write("tIP Addresses: "
IPAddress ipaddr;
for each(ipaddr in hostInfo->AddressList) {
Console::Write(ipaddr->ToString() + " "
}
Console::WriteLine();
Console::Write("tAliases: "
String alias;
for each ( alias in hostInfo->Aliases) {
Console::Write(alias + " "
}
Console::WriteLine("n"
} catch (Exception) {
Console::WriteLine("tUnable to resolve host: " + host + "n"
}
}
int main(array<System::String > args)
{
try {
Console::WriteLine("Local Host:"
String localHostName = Dns::GetHostName();
Console::WriteLine("tHost Name: " + localHostName);
PrintHostInfo(localHostName);
} catch (Exception) {
Console::WriteLine("Unable to resolve local hostn"
}
String arg;
for each ( arg in args) {
Console::WriteLine(arg + ":"
PrintHostInfo(arg);}
Console::ReadLine();
return 0;
}
-----------------------------------------------------------------------------------------------
[
using namespace System;
using namespace System::Net;
using namespace System::Net::Sockets;
void PrintHostInfo(String host) {
try {
IPHostEntry hostInfo;
hostInfo = Dns::Resolve(host);
Console::WriteLine("tCanonical Name: " + hostInfo->HostName);
Console::Write("tIP Addresses: "
IPAddress ipaddr;
for each(ipaddr in hostInfo->AddressList) {
Console::Write(ipaddr->ToString() + " "
}
Console::WriteLine();
Console::Write("tAliases: "
String alias;
for each ( alias in hostInfo->Aliases) {
Console::Write(alias + " "
}
Console::WriteLine("n"
} catch (Exception) {
Console::WriteLine("tUnable to resolve host: " + host + "n"
}
}
int main(array<System::String > args)
{
try {
Console::WriteLine("Local Host:"
String localHostName = Dns::GetHostName();
Console::WriteLine("tHost Name: " + localHostName);
PrintHostInfo(localHostName);
} catch (Exception) {
Console::WriteLine("Unable to resolve local hostn"
}
String arg;
for each ( arg in args) {
Console::WriteLine(arg + ":"
PrintHostInfo(arg);}
Console::ReadLine();
return 0;
}
-----------------------------------------------------------------------------------------------
[