anuj, I've attached a DNS class I wrote/use.� Let me know if you have any 
questions.� Here's some code I've used to call it in the past:

private void Page_Load(object sender, System.EventArgs e)
��{
���IntPtr ppQueryResultsSet = IntPtr.Zero;
���try
���{
����UInt32 dns_status = 1;
����//IPAddress.Parse("199.45.32.43").Address
����DNS.IP4_ARRAY server = new NetTools.DNS.IP4_ARRAY();
����server.AddrArray = new UInt32[1];
����server.AddrCount = 1;
����server.AddrArray[0] = DNS.inet_addr("199.45.32.43"); 
//(UInt32)IPAddress.Parse("199.45.32.43").Address;  

����Response.Write(server.AddrArray[0] + "<br>");
����//723529159
����//IntPtr serv = Marshal.AllocHGlobal(Marshal.SizeOf(server));
����//Marshal.StructureToPtr(server, serv, true);  

� 

����dns_status = DNS.DnsQuery(
�����"gewing.com",
�����DNS.DNS_TYPE_MX,
�����DNS.DNS_QUERY_BYPASS_CACHE,
�����null,
�����out ppQueryResultsSet,
�����(UInt32)0
�����); 

����Response.Write(dns_status + "<br>");
����if (dns_status == 0)
����{ 

�����DNS.DNS_RECORD QueryResultsSet = (DNS.DNS_RECORD)Marshal.PtrToStructure(
������ppQueryResultsSet, typeof(DNS.DNS_RECORD)); 

�����while (!QueryResultsSet.Next.Equals(IntPtr.Zero))
�����{
������Response.Write (QueryResultsSet.Data.pNameHost + "<br>");
����
������QueryResultsSet = (DNS.DNS_RECORD)Marshal.PtrToStructure(
�������QueryResultsSet.Next, typeof(DNS.DNS_RECORD));
�����}
����}
����else
����{
�����Response.Write ("Error during query");
����}
���}
���catch(Exception exc)
���{
����Response.Write(exc.Message);
���}
���finally
���{
����DNS.DnsRecordListFree(ppQueryResultsSet, 1);�
���}
��}

Greg Ewing [MVP]
www.citidc.com 

----------------------------------------

From: Anuj Kumar <[EMAIL PROTECTED]>
Sent: Tuesday, April 05, 2005 7:59 AM
To: [email protected]
Subject: [AspNetAnyQuestionIsOk] please help me.. DnsQuery()...? 

Is there any Gentle man in this group who can help me for following problem,,,,,
I need to develop a utility which can check the status of DNS Server running on 
a computer in our local network..
here this utility can be run from any computer in network.. and the mean of 
status is whether the DNS Server is running or not... in case of The Primary 
DNS Server is down we can use the Alternative DNS Server running on a different 
machine...
Please help me.. i am waiting for ur reply....
bye & take care
...anuj

Yahoo! India Matrimony: Find your life partneronline.

[Non-text portions of this message have been removed]

Yahoo! Groups Links







[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to