Solved

DNS server: res_send, EAFNOSUPPORT

Posted on 2003-11-29
1
265 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
ID: 9846486
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

786 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