Thanks Chris ! I'd noticed the same thing, viz the hostname being returned by gethostbyname was a different value for load balancing purposes. Anyways, I tried using the second value in the list testHostentP->h_addr_list[1] & it worked just fine ! Guess I'll have to loop through the list & use the first not null value.
This is really strange though ! The Netlibrary seems to be messing up somewhere. Could something be done about this ? Does anyone know why this happens ? Thanks again. "Chris Faherty" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > On Monday 03 March 2003 05:33 am, sylBEERt wrote: > > > I'm making a call to gethostbyname on the Palm & it seems to be failing > > ONLY for a particular hostname. I use exactly the same code .. with the > > same hostname in a c++ program on linux & it works just fine !! Ofcourse > > I'm using Berkley Sockets. What is wierd is that this bit of code was > > working perfectly well until a week ago!! > > > > the hostname for which my code is failing is: 'toc.oscar.aol.com' > > (snip) > > > I get success, but testHostentP->h_addr holds a NULL value. As a result of > > which, connect fails ! > > > > Can't see what I'm doing wrong. Any solutions, suggestions anyone ? > > This may not be related, but I noticed a strange thing like that on a > particular host as well. It was a particular DNS entry which returned > different values to balance the load, and it began freaking out my Palm > applications. What I found was needed was to enumerate the list provided > within the returned NetHostInfoPtr, as sometimes the first entry would be > blank -- which is I believe the same value as ->h_addr. > > NetSocketAddrINType saddr; > NetHostInfoPtr phe; > NetHostInfoBufType AppHostInfo; > > if ((phe = NetLibGetHostByName(AppNetRefnum, host, &AppHostInfo, > AppNetTimeout, &errno)) != 0) { > /* > * Sometimes the first address in the list is zero. This > * makes me have to search through them to find the first > * non-zero address. > */ > for (i1=0; i1 < netDNSMaxAddresses; i1++) { > if (phe->addrListP[i1] != NULL) { > if (*phe->addrListP[i1] != '\0') { > MemMove((char *) &saddr.addr, > (char *) phe->addrListP[i1], phe->addrLen); > nameresolved = true; > break; > } > } > } > } > > -- > /* Chris Faherty <[EMAIL PROTECTED]> */ > > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/