• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
gethostbyname problem with XCode ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: gethostbyname problem with XCode ?
      • From: Vincent Lubet <email@hidden>
    • Re: gethostbyname problem with XCode ?
      • From: Justin Walker <email@hidden>
  • Prev by Date: Re: OTMP with an Async Notifier Model
  • Next by Date: Re: UDP broadcast address
  • Previous by thread: Re: UDP broadcast address
  • Next by thread: Re: gethostbyname problem with XCode ?
  • Index(es):
    • Date
    • Thread