Solved

DNS server: res_send, EAFNOSUPPORT

Posted on 2003-11-29
1
241 Views
Last Modified: 2011-09-20
This is a DNS programming question. I donnot know where I should post so I put it here. I am writing some c code to resolve the addresses of a large amount of domain names contained in a file. Part of the code is as follows:

     queryLen = res_mkquery(
                     ns_o_query,     /* regular query */
                     domain,         /* the domain to look up */
                     ns_c_in,        /* Internet type */
                     qtype,          /* Look up the specified type record */
                     (u_char *)NULL, /* always NULL */
                     0, /* length of NULL */
                     (u_char *)NULL, /* always NULL */
                     (u_char *)&query, /* buffer for the query */
                     sizeof(query)); /* size of the buffer */

    /*
     * Send the query packet. If there is no name server
     * running on the target host, res_send() returns -1
     * and errno is ECONNREFUSED. First, clear out errno.
     */
    errno = 0;
    responseLen = res_send ((u_char *)&query,/* the query */
                         queryLen, /* true length*/
                         (u_char *)&response,/*buffer */
                         sizeof(response)); /*buf size*/

  if(responseLen < 0) { /* error */

      if (errno == ECONNREFUSED) { /* no server on the host */
      (void) fprintf (stderr,
                    "There is no name server running on %s\n",
                  nsList [nsNum]);

      } else {                   /* anything else: no response */
      (void) fprintf (stderr,
                  "There was no response from %s\n",
                  nsList [nsNum]);
      }

      continue; /* nsNum for-loop */
    }

Right after the res_send() is called, the errno is set to EAFNOSUPPORT. Can anybody tell me what is the problem here? Many thanks.

Soccer
0
Comment
Question by:summer_soccer
1 Comment
 
LVL 15

Accepted Solution

by:
periwinkle earned 40 total points
Comment Utility
Is it possible that your program is trying to use IPv6 addresses, but the machine it is querying doesn't support it?
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now