Xun Cheng wrote:
> When it's time to run gethostbyname("localhost") (whatever the
> argument), it says
> OUCH: nested memory code, to 1 levels.
> Program terminated with signal SIGKILL, Killed.
Hi Xun,
I do a lot of socket programming, and yet I have never come across that
problem.
Some hints & tips:
==================
Have you included netdb.h?
eg...
#include <netdb.h>
Have you declared the return value and the function?
eg...
struct hostent *hp, *gethostbyname();
Are you using it correctly?
eg...
hp = gethostbyname(hostname);
if (hp == 0) {
fprintf(stderr, "ERROR> %s: unknown host", hostname);
exit(1);
}
Also, are you aware that as well as /etc/hosts, it used NIS (network
information service) and named (the name server)? The default is to
query named first. So, make sure that named is up and running without
any problems. Also, make sure that the hostname actually exists
somewhere (though that shouldn't cause an error like that anyway). And,
I have never used gethostbyname on the localhost... are you sure that's
wise? I can't see a reason for it.
Regards,
David Taylor.
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject.