• 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: Listening on an interface
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Listening on an interface


  • Subject: Re: Listening on an interface
  • From: Quinn <email@hidden>
  • Date: Wed, 22 Jan 2003 13:10:34 +0000

At 13:45 +0100 22/1/03, Bernd Lvhr wrote:
Under Mac OS X, how can I bind to a specific interface if there are more than one?

Depends on what API you're using. If you're using sockets, you can just put the IP address of the interface to which you want to bind into the sockaddr that you pass to "bind". A similar approach works for the OT API.

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.

<http://developer.apple.com/technotes/tn/tn1145.html>

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.

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.

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.

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>

There's also been several discussions of this on the MacNetworkProg mailing list. If you follow the links from the mailing list's web page, you will find a searchable archive of that material.

<http://www.lists.apple.com/macnetworkprog>

The drawback to using "ppplib" is that it's not officially supported by Apple. Here's a statement that the manager of our network engineering team posted to the list just recently.

Let me emphasis the PPPLib code does not defines an API (Application
Programming Interface). This is just a sample code that is part of
Darwin but it is not part of Mac OS X. Apple is not making any
guaranty the PPPLib code does actually work now or will work in
future releases of Mac OS X.

Obviously, we are aware of the usefulness of PPPLib and we will try
to keep PPPLib working.

Use at your own risk!

Vincent Lubet
Manager,
Networking Team Apple

Apple is aware of these problems and intends to rectify them, probably by releasing a new, CF-friendly, PPP API in a future major release of Mac OS X.

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.

  • Follow-Ups:
    • Re: Listening on an interface
      • From: Bernd Löhr <email@hidden>
References: 
 >Listening on an interface (From: Bernd Löhr <email@hidden>)

  • Prev by Date: Listening on an interface
  • Next by Date: Re: Listening on an interface
  • Previous by thread: Listening on an interface
  • Next by thread: Re: Listening on an interface
  • Index(es):
    • Date
    • Thread