How to tell which interface is active on OS X ?
How to tell which interface is active on OS X ?
- Subject: How to tell which interface is active on OS X ?
- From: Matt Mashyna <email@hidden>
- Date: Thu, 21 Mar 2002 11:35:16 -0500
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.