home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.protocols.tcp-ip      TCP and IP network protocols.      14,669 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 12,820 of 14,669   
   Aaron Spiteri    
   Re: res_search   
   19 Apr 09 12:03:21   
   
   96ee73a9   
   XPost: comp.unix.programmer   
      
   On 2009-04-19 11:26:29 +1000, David Schwartz  said:   
      
   > On Apr 18, 5:58 pm, Aaron Spiteri  wrote:   
   >   
   >> I am a newbie at network programming and have been trying to get the   
   >> res_search() function to work.  I have searched through many man pages   
   >> and websites and still keep on getting a segment error.  I am sure the   
   >> answer is fairly obvious with somone with experience but I can't seem   
   >> to get it to work.  Here is a copy of the code I am trying to compile.   
   >   
   > Are you calling 'res_init'? The 'res_research' function needs to know   
   > the search order and whatnot.   
   >   
   > DS   
      
   I have added the res_init() function. AFAK the res_search function   
   calls this.   The code looks like this:   
      
   #include    
      
   #define MAXPACKETSIZE IPV6_MAXPACKET   
      
   boolean_t   
   SniffResolver()   
   {   
   	// Arguments   
   	const char dname = "azzmosphere.azzmos.com.au";   
   	int  anslen      = MAXPACKETSIZE;   
   	// end arguments   
      
      
   	u_char *answer = malloc(MAXPACKETSIZE);   
   	int ranslen = 0;   
      
   	ranslen = res_init();   
   	syslog(LOG_DEBUG, "_res.options = '%d'", _res.options);   
   	   
   	ranslen = res_search(dname, C_IN, T_A, answer, anslen);   
   	   
   	syslog(LOG_DEBUG, "ranslen = '%d'", ranslen);   
      
      
   	return TRUE;   
   }   
      
   now, but I am still get a "Segmentation fault".  However the syslog is   
   reporting the following:   
      
   Apr 19 12:00:03 azzmosphere sniff2: _res.options = '1729'   
      
   So my guess is that res_init is suceeding but res_search is not.   
   --   
   ....   
   "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)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca