• 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: Problem in getting local IP through
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Problem in getting local IP through


  • Subject: RE: Problem in getting local IP through
  • From: Pranav Kumar Sahu <email@hidden>
  • Date: Wed, 25 Jun 2003 10:21:17 +0530

Actually i am using "gethostbyname()" to get the hostent and then I am
converting it to a in_addr. Where I have the problem with the IP Address.
Since it returns proper IP Address in some systems and "127.0.0.1" in few
system, I feel I need to configure some network setting.

--Pranav

-----Original Message-----
From: Joshua Graessley [mailto:email@hidden]
Sent: Tuesday, June 24, 2003 11:34 PM
To: Pranav Kumar Sahu
Cc: email@hidden
Subject: Re: Problem in getting local IP through



I'm not sure how you're using inet_ntoa to get the local IP address.
You should use getifaddrs. getifaddrs will return a list of all IP
addresses, not just one. Are you really sure you need to know the
address? When binding, it is best to just by to INADDR_ANY. If you're
sending your address across the wire, you will start to run in to all
sorts of nasty problems with things such as NAT and scoped addresses.

-josh

On Tuesday, June 24, 2003, at 5:24, Pranav Kumar Sahu wrote:

> Hi All,
>
> I am using "inet_ntoa" to get the local IP. In some systems it returns
> me
> proper IP. But in some system's it give 127.0.0.1 i.e loopback IP. Is
> there
> some network setting required, that are missing on some systems ?
>
> Rgds
> Pranav Kumar Sahu
> QUARK MEDIA
> Ext :9742
>
> --Reality is what, when you stop believing in it, doesn't go away.
> Failure is not an option. It is a privilege reserved for those who try.
> _______________________________________________
> 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.

  • Follow-Ups:
    • Re: Problem in getting local IP through
      • From: "Justin C. Walker" <email@hidden>
  • Prev by Date: Re: Exception in Mapper?
  • Next by Date: Re: Problem in getting local IP through
  • Previous by thread: Re: Problem in getting local IP through
  • Next by thread: Re: Problem in getting local IP through
  • Index(es):
    • Date
    • Thread