gethostbyname problem with XCode ?
gethostbyname problem with XCode ?
- Subject: gethostbyname problem with XCode ?
- From: Matt Mashyna <email@hidden>
- Date: Tue, 10 Feb 2004 08:55:31 -0500
I've been playing with unix again after a long time away. It's good
to be back and rid of OT! When I call this code to set up a listening
socket it works fine in the debugger. It worked with Project Builder.
But when I turn off XCode's zero link and the other debugging
options, gethostbyname fails. gethostname does work. Should I cheat
and set hostname to "127.0.0.1" ?
Any ideas what could be wrong with the non-debug build ?
*hostname = '\0';
/*
* Get my hostname and IP address.
*/
if (hostname[0] == '\0') {
if (gethostname(hostname, sizeof(hostname)) == -1) {
syslog(LOG_ERR, "Can't get hostname\n");
exit(1);
}
}
hep = gethostbyname(hostname);
if (!hep) {
syslog(LOG_ERR, "Can't get my IP address\n");
exit(1);
}
--
----------------------------------------------------------------
Matt Mashyna
email@hidden
The Frodis Co
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.