Started networking tools
This commit is contained in:
26
C#/Networking Tools/Networking Tools/DNSTest.cs
Normal file
26
C#/Networking Tools/Networking Tools/DNSTest.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Networking_Tools {
|
||||
class DNSTest {
|
||||
public string HostName { get; set; }
|
||||
|
||||
public string[] GetIPs() {
|
||||
List<string> ipAddresses = new List<string>();
|
||||
IPHostEntry iphost = Dns.GetHostEntry(HostName);
|
||||
|
||||
foreach (IPAddress theAddress in iphost.AddressList) {
|
||||
if (theAddress.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) {
|
||||
ipAddresses.Add(theAddress.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
return ipAddresses.ToArray();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user