• 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: How to tell which interface is active on OS X ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to tell which interface is active on OS X ?


  • Subject: Re: How to tell which interface is active on OS X ?
  • From: Peter Sichel <email@hidden>
  • Date: Thu, 21 Mar 2002 13:06:32 -0500

You need to get the local protocol address from the connected
socket (or endpoint) since more than one interface might be
active. Both Open Transport and BSD networking provide a function
for just this purpose.

Using System Preferences or Location Manager is not a
correct solution.

Kind Regards,

- Peter

At 11:35 AM -0500 3/21/02, Matt Mashyna wrote:
I have been working on updating an ftp client implementation to run on OS X. While in progress I was adding support for non-passive data channels. Before the client can tell the server what port to use on the client, the client has to know it's own address. So, to get it I call:

OTInetGetInterfaceInfo(&info, 0);
OTInitInetAddress(&ipAddress, mPort, info.fAddress);

Works OK but then I realized that it was getting the address for the AirPort adapter rather than the ethernet adapter. If I change the interface number arg in OTInetGetInterfaceInfo to 1 I get the address for the ethernet adapter.

I thought that 0 asked for the default interface. I guess this is not the case. The location I have set up in the system preferences prefers ethernet before AirPort. What was more amazing was that when I ran Transmit to the same server and looked at the transcript window Transmit also went with the AirPort interface rather than the ethernet. That explains some of the crappy throughput I get sometimes when I'm in an office plugged into the 100BT but close enough to the AirPort hub to get a weak signal. My old office was too far from the hub to get a signal through the Ti shell so this never came up before.

Right, enough ranting. How do I determine what interface I should be using based on the system preferences on OS X and the location manager on OS 9.

Matt

--
_______________________________________________
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: How to tell which interface is active on OS X ?
      • From: Quinn <email@hidden>
References: 
 >How to tell which interface is active on OS X ? (From: Matt Mashyna <email@hidden>)

  • Prev by Date: Re: How to tell which interface is active on OS X ?
  • Next by Date: RE: Stops Receiving UDP Packets
  • Previous by thread: Re: How to tell which interface is active on OS X ?
  • Next by thread: Re: How to tell which interface is active on OS X ?
  • Index(es):
    • Date
    • Thread