RE: BSD equivalent of OTInetGetInterfaceInfo
RE: BSD equivalent of OTInetGetInterfaceInfo
- Subject: RE: BSD equivalent of OTInetGetInterfaceInfo
- From: Pranav Kumar Sahu <email@hidden>
- Date: Wed, 28 Jan 2004 09:48:26 +0530
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.
I think you can even use gethostbyname. This will return you a hostent
structure,
that will again have a list of all IP addresses.
Rgds
--Pranav Sahu
QUARK MEDIA
-----Original Message-----
From: Quinn [
mailto:email@hidden]
Sent: Tuesday, January 27, 2004 4:14 PM
To: email@hidden
Subject: Re: BSD equivalent of OTInetGetInterfaceInfo
At 11:20 +0100 27/1/04, Sascha Kratky wrote:
>
under Mac OS X which BSD function can be used instead of
>
OTInetGetInterfaceInfo to obtain the machine's IP address?
The routine you want is getifaddrs. However, you need to be careful
about using this information. See the discussion in DTS Technote
1145 "Living in a Dynamic TCP/IP Environment" for details about the
potential problems.
<
http://developer.apple.com/technotes/tn/tn1145.html>
S+E
--
Quinn "The Eskimo!" <
http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
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.