Re: Listening on an interface
Re: Listening on an interface
- Subject: Re: Listening on an interface
- From: Bernd Löhr <email@hidden>
- Date: Wed, 22 Jan 2003 16:33:22 +0100
Hi Quinn,
Am Mittwoch, 22.01.03 um 14:10 Uhr schrieb Quinn:
Preferably I want to give the user a list of the active network
configuration ports to chose from. Our IP server should listen on
that interface only, then. Default would be to listen on all.
With the aid of MoreSCF and TN 1145 I got the list of network port
names as well as the BSD port names. To get to the corresponding IP
addresses, I could iterate through the sc list as in TN 1145, but do
the IPs of PPP connections show up when connected? Iterating with
OTInetGetInterfaceInfo won't reveal the interface name.
Have you looked at Technote 1145? It contains a bunch of helpful
hints on this topics.
Yes, I looked, as noted above :-))
For example, the CopyIPAddressListSCF will give you a list of all the
system's IP addresses, and because it's tied in with SCF it'd be easy
to match these up with the user-visible name available via MoreSCF.
This works for static IP connections, but PPP addresses only show up in
SCDynamicStore, but again not the user-visible name...
Alternatively, the getifaddrs call will give you the IP address and
the BSD name for each interface. You can then search the list of
ports returned by MoreSCF looking for the one with the right BSD name,
and get the user visible name that way.
That sounds interesting.
To recap:
My app needs to store the port config (user visible name) between
invocations. On start it looks for the IP address of that config
through MoreSCF; if there is no IP (b/c it's dynamic) it takes the BSD
name and gets the IP via getifaddrs? Correct? I'll give that a try.
And: How can I force a PPP connection if I only want to listen? Under
traditional Mac OS opening a provider would automatically connect and
give me an IP address to bind to...
Generally the Mac OS X behaviour is considered an improvement over Mac
OS 9. However, I can see why you might want the old behaviour back.
Well, you can't make it right for everybody :-)
Probably the best way to do this is to explicitly request that PPP
dial. Unfortunately the OT/PPP API does not give you a way to dial a
specific interface, so you have to use "ppplib". Here's some info I
wrote up about "ppplib" for another developer.
You can use the "ppplib" code from the Darwin PPP sources. You can
find a quick tutorial on this on the following web page.
<http://www.cocoadevcentral.com/tutorials/
showpage.php?show=00000026.php>
It moved to <
http://cocoadevcentral.com/articles/000033.php#000033>
Thanks
Bernd
_______________________________________________
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.