• 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
Re: gethostname() and gethostbyname() APIs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gethostname() and gethostbyname() APIs


  • Subject: Re: gethostname() and gethostbyname() APIs
  • From: Graham Parkinson-Morgan <email@hidden>
  • Date: Tue, 4 May 2004 08:45:50 -0700

First, I suggest, Navin, that you search the archives for the macnetworkprog mailing list using the keyword 'gethostname' as I did this morning.
It is an education. And as a result of reading the last round of discussions about gethostname back in February, I am going to have to revisit some ALAP code to *remove* the assumed connection between gethostname and gethostbyname. Seems that the choice of routine names here easily leads to that conflation.

Secondly, I hope that code chunk is not really from Quark code: as hstruct has the potential to be NULL, so inaddr can be left undefined, and yet is used outside the test on hstruct.

On May 3, 2004, at 10:53 PM, Navin Sharma wrote:

I do not deny that application may have some problem. But, have a query that
why the two APIs are behaving properly in Panther Client and not in Panther
Server.

Below is the code chunk:
******************************************************
hostent *hstruct;
in_addr *inaddr;
err = gethostname(name,255);
hstruct = gethostbyname(name);
if(hstruct){
inaddr = (in_addr *) hstruct->h_addr;
}
strcpy(address, (const char *) inet_ntoa(*inaddr));
******************************************************

Runs fine on Panther Client (10.3.3) and not on Panther Server (10.3.3). Am
I doing some OS specific thing?
Thanks in advance.

Regards
Navin Sharma
_______________________________________________
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.
_______________________________________________
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.


References: 
 >RE: gethostname() and gethostbyname() APIs (From: Navin Sharma <email@hidden>)

  • Prev by Date: Re: gethostname() and gethostbyname() APIs
  • Next by Date: Re: CFSocket crash in Jaguar [solved]
  • Previous by thread: Re: gethostname() and gethostbyname() APIs
  • Next by thread: CFSocket crash in Jaguar
  • Index(es):
    • Date
    • Thread