Search in sources :

Example 11 with DnsClient

use of io.vertx.core.dns.DnsClient in project vert.x by eclipse.

the class DNSExamples method example3.

public void example3(Vertx vertx) {
    DnsClient client = vertx.createDnsClient(53, "10.0.0.1");
    client.lookup4("vertx.io", ar -> {
        if (ar.succeeded()) {
            System.out.println(ar.result());
        } else {
            System.out.println("Failed to resolve entry" + ar.cause());
        }
    });
}
Also used : DnsClient(io.vertx.core.dns.DnsClient)

Example 12 with DnsClient

use of io.vertx.core.dns.DnsClient in project vert.x by eclipse.

the class DNSExamples method example8.

public void example8(Vertx vertx) {
    DnsClient client = vertx.createDnsClient(53, "10.0.0.1");
    client.resolveMX("vertx.io", ar -> {
        if (ar.succeeded()) {
            List<MxRecord> records = ar.result();
            for (MxRecord record : records) {
                System.out.println(record);
            }
        } else {
            System.out.println("Failed to resolve entry" + ar.cause());
        }
    });
}
Also used : DnsClient(io.vertx.core.dns.DnsClient) MxRecord(io.vertx.core.dns.MxRecord)

Example 13 with DnsClient

use of io.vertx.core.dns.DnsClient in project vert.x by eclipse.

the class DNSExamples method example2.

public void example2(Vertx vertx) {
    DnsClient client = vertx.createDnsClient(53, "10.0.0.1");
    client.lookup("vertx.io", ar -> {
        if (ar.succeeded()) {
            System.out.println(ar.result());
        } else {
            System.out.println("Failed to resolve entry" + ar.cause());
        }
    });
}
Also used : DnsClient(io.vertx.core.dns.DnsClient)

Example 14 with DnsClient

use of io.vertx.core.dns.DnsClient in project vert.x by eclipse.

the class DNSExamples method example5.

public void example5(Vertx vertx) {
    DnsClient client = vertx.createDnsClient(53, "10.0.0.1");
    client.resolveA("vertx.io", ar -> {
        if (ar.succeeded()) {
            List<String> records = ar.result();
            for (String record : records) {
                System.out.println(record);
            }
        } else {
            System.out.println("Failed to resolve entry" + ar.cause());
        }
    });
}
Also used : DnsClient(io.vertx.core.dns.DnsClient)

Example 15 with DnsClient

use of io.vertx.core.dns.DnsClient in project vert.x by eclipse.

the class DNSExamples method example12.

public void example12(Vertx vertx) {
    DnsClient client = vertx.createDnsClient(53, "10.0.0.1");
    client.resolveSRV("vertx.io", ar -> {
        if (ar.succeeded()) {
            List<SrvRecord> records = ar.result();
            for (SrvRecord record : records) {
                System.out.println(record);
            }
        } else {
            System.out.println("Failed to resolve entry" + ar.cause());
        }
    });
}
Also used : DnsClient(io.vertx.core.dns.DnsClient) SrvRecord(io.vertx.core.dns.SrvRecord)

Aggregations

DnsClient (io.vertx.core.dns.DnsClient)30 Test (org.junit.Test)16 DnsException (io.vertx.core.dns.DnsException)4 MxRecord (io.vertx.core.dns.MxRecord)4 SrvRecord (io.vertx.core.dns.SrvRecord)4 DnsResponseCode (io.vertx.core.dns.DnsResponseCode)3 NioDatagramChannel (io.netty.channel.socket.nio.NioDatagramChannel)2 InetAddress (java.net.InetAddress)2 InetSocketAddress (java.net.InetSocketAddress)2 List (java.util.List)2 Bootstrap (io.netty.bootstrap.Bootstrap)1 ChannelFuture (io.netty.channel.ChannelFuture)1 ChannelFutureListener (io.netty.channel.ChannelFutureListener)1 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)1 ChannelInitializer (io.netty.channel.ChannelInitializer)1 ChannelOption (io.netty.channel.ChannelOption)1 ChannelPipeline (io.netty.channel.ChannelPipeline)1 SimpleChannelInboundHandler (io.netty.channel.SimpleChannelInboundHandler)1 DatagramChannel (io.netty.channel.socket.DatagramChannel)1 DatagramDnsQuery (io.netty.handler.codec.dns.DatagramDnsQuery)1