XPost: comp.unix.programmer   
      
   On 2009-04-19 12:08:48 +1000, Ian Collins said:   
      
   > Aaron Spiteri wrote:   
   >> Hi folks,   
   >>   
   >> I am a newbie at network programming and have been trying to get the   
   >> res_search() function to work.   
   >   
   > You don't say which platform you are using, but at least on Solaris,   
   > res_search() and friends are deprecated in favour of the res_nxxx()   
   > family of functions.   
   >   
   > Either way, call res_[n]init() first.   
      
   I am MAC OSX 10.4.11, and dd-wrt LINUX 2.4.46, I couldn't find a man   
   page on the MAC for res_ninit, however I did find it included in the   
   resolve.h header file. After a bit of googling I revamped the code to   
   look like this:   
      
   #include    
      
   #define MAXPACKETSIZE IPV6_MAXPACKET   
      
   boolean_t   
   SniffResolver()   
   {   
    // Arguments   
    const char dname = "azzmosphere.azzmos.com.au";   
    int anslen = MAXPACKETSIZE;   
    // end arguments   
      
    res_state statep;   
      
    u_char *answer = malloc(MAXPACKETSIZE);   
    int ranslen = 0;   
      
    ranslen = res_ninit(statep);   
      
    //ranslen = res_init();   
    //syslog(LOG_DEBUG, "_res.options = '%d'", _res.options);   
      
    syslog(LOG_DEBUG, "ranslen = '%d'", ranslen);   
      
       
    ranslen = res_nsearch(statep, dname, C_IN, T_A, answer, anslen);   
       
    syslog(LOG_DEBUG, "ranslen = '%d'", ranslen);   
      
      
    return TRUE;   
   }   
      
      
   Unfortunately still getting exactly the same error????   
   --   
   ....   
   "When asked what he would like on his tomb stone he said more bass"   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|