Re: How to tell which interface is active on OS X ?
Re: How to tell which interface is active on OS X ?
- Subject: Re: How to tell which interface is active on OS X ?
- From: Vincent Lubet <email@hidden>
- Date: Thu, 21 Mar 2002 08:54:32 -0800
On Thursday, March 21, 2002, at 08:35 AM, 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);
This is getting the address of the first interface but what you want is
the primary interface.
Use instead:
OTInetGetInterfaceInfo(&info, kDefaultInetInterface);
Vincent
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.
_______________________________________________
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.