コード例 #1
0
ファイル: Example.cs プロジェクト: TyKonKet/dns
        public static void Main(string[] args)
        {
            DnsServer server = null;

            (new Thread(() => {
                server = new DnsServer("8.8.8.8");

                server.Responded += (request, response) => Console.WriteLine("{0} => {1}", request, response);

                server.MasterFile.AddIPAddressResourceRecord("google.com", "127.0.0.1");

                server.Listen();
            })).Start();

            Thread.Sleep(1000);

            //Client client = new Client("72.21.204.209");
            //Client client = new Client("8.8.8.8");
            DnsClient client = new DnsClient("127.0.0.1");

            client.Reverse(IPAddress.Parse("173.194.69.100"));
            client.Lookup("google.com");
            //client.Lookup("dr.dk");
            //Console.WriteLine(client.Resolve("dnstest.managemydedi.com", RecordType.AAAA));

            client.Lookup("cnn.com");

            server.Close();
        }
コード例 #2
0
ファイル: ClientExample.cs プロジェクト: kzu/dns
        public static void Main(string[] args)
        {
            DnsClient client = new DnsClient("8.8.8.8");

            foreach (string domain in args) {
                IList<IPAddress> ips = client.Lookup(domain);
                Console.WriteLine("{0} => {1}", domain, string.Join(", ", ips));
            }
        }