public class DnsRequest
extends java.lang.Object
implements java.io.Serializable
// create new instance Dns dns = new Dns(); // creates DNS request with nameserver and domain as arguments DnsRequest request = new DnsRequest("ns.myserver.com","myserver.com"); // retrieve only MX (mail exchanger) records request.setRecordType(Dns.TYPE_MX); // gets DNS response DnsResponse response = dns.getResponse(request); // print out records for response to console Enumeration e = response.getAnswers(); while(e.hasMoreElements()) { DnsRecord record = (DnsRecord) e.nextElement(); System.out.println(record); }
Constructor and Description |
---|
DnsRequest(java.lang.String nameserver,
java.lang.String domain)
Constructs a new
DnsRequest instance. |
DnsRequest(java.lang.String nameserver,
java.lang.String domain,
int recordType)
Constructs a new
DnsRequest instance. |
DnsRequest(java.lang.String nameserver,
java.lang.String domain,
int recordType,
int classType)
Constructs a new
DnsRequest instance
The constants for recordType and classType are defind in Dns class. |
Modifier and Type | Method and Description |
---|---|
int |
getClassType()
Gets class type to retrieve for this
DnsRequest . |
java.lang.String |
getDomain()
Gets hostname or IP address to lookup for this
DnsRequest . |
java.lang.String |
getNameserver()
Gets nameserver used to perform this
DnsRequest . |
int |
getQueryId()
Gets query id for this
DnsRequest . |
int |
getRecordType()
Gets record type to retrieve for this
DnsRequest . |
int |
getTimeout()
Gets the timeout for opening connection to DNS server.
|
void |
setClassType(int classType)
Sets class type to retrieve for this
DnsRequest . |
void |
setDomain(java.lang.String domain)
Sets hostname or IP address to lookup for this
DnsRequest . |
void |
setNameserver(java.lang.String nameserver)
Sets nameserver used to perform this
DnsRequest . |
void |
setRecordType(int recordType)
Sets record type to retrieve for this
DnsRequest . |
void |
setTimeout(int timeout)
Sets the timeout for opening connection to DNS server.
|
public DnsRequest(java.lang.String nameserver, java.lang.String domain)
DnsRequest
instance.nameserver
- the hostname or IP address of the DNS serverdomain
- the hostname or IP address to lookuppublic DnsRequest(java.lang.String nameserver, java.lang.String domain, int recordType)
DnsRequest
instance.
The constants for recordType
are defind in Dns class.nameserver
- the hostname or IP address of the DNS serverdomain
- the hostname or IP address to lookuprecordType
- the type of records to retrieveDns
public DnsRequest(java.lang.String nameserver, java.lang.String domain, int recordType, int classType)
DnsRequest
instance
The constants for recordType
and classType
are defind in Dns
class.nameserver
- the hostname or IP address of the DNS serverdomain
- the hostname or IP address to lookuprecordType
- the type of records to retrieveclassType
- the class of records to retrieveDns
public java.lang.String getNameserver()
DnsRequest
.public void setNameserver(java.lang.String nameserver)
DnsRequest
.nameserver
- the nameserver used to perform this DnsRequest
public int getRecordType()
DnsRequest
.public void setRecordType(int recordType)
DnsRequest
.recordType
- the record type to retrieve for this DnsRequest
public int getClassType()
DnsRequest
.public void setClassType(int classType)
DnsRequest
.classType
- the class type to retrieve for this DnsRequest
public java.lang.String getDomain()
DnsRequest
.public void setDomain(java.lang.String domain)
DnsRequest
.domain
- the hostname or IP address to lookup for this DnsRequest
public int getQueryId()
DnsRequest
.public void setTimeout(int timeout)
timeout
- the timeout in millisecondspublic int getTimeout()
Copyright © JSCAPE LLC. 1999-2021. All Rights Reserved