• 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
Gethostname returns incomplete name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Gethostname returns incomplete name


  • Subject: Gethostname returns incomplete name
  • From: Laurie Gill <email@hidden>
  • Date: Tue, 06 Jul 2010 22:07:16 -0700
  • Thread-topic: Gethostname returns incomplete name

The following code snippet seems to work on intel but I get mixed results on
powerpc. Gethostname always returns noErr but sometimes the name I get back
doesn't work in gethostbyname. Result: Host is nil and h_errno is 1.

    char hostnamebuf[256];
    struct hostent *host;

    if ((err = gethostname(hostnamebuf, sizeof(hostnamebuf))) == 0)
        host = gethostbyname(hostnamebuf);

Example:
The name I get is "plechatovm2k3-0"
The name I should get is "plechatovm2k3-0.lss.corp.com". This one works when
I hard code it.

Any ideas?

Thanks
Laurie Gill
Roxio Retrospect
Sonic Solutions

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Gethostname returns incomplete name
      • From: "Justin C. Walker" <email@hidden>
    • Re: Gethostname returns incomplete name
      • From: Josh Graessley <email@hidden>
  • Prev by Date: UDP Multicast Question
  • Next by Date: Re: Gethostname returns incomplete name
  • Previous by thread: Re: UDP Multicast Question
  • Next by thread: Re: Gethostname returns incomplete name
  • Index(es):
    • Date
    • Thread