• 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: Finding preferred interface
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding preferred interface


  • Subject: Re: Finding preferred interface
  • From: Josh Graessley <email@hidden>
  • Date: Thu, 26 Jan 2006 12:51:21 -0800


You could use a routing socket and perform a get operation to find the route. You'll also want to watch for network change events and do the lookup again.


-josh

On Jan 26, 2006, at 12:39 PM, Matt Slot wrote:

I'm writing code to talk to the gateway and enable port-mapping, if
it's supported. OTInetGetInterfaceInfo() gives me the gateway address
for a given interface, but how do I identify which one I want?

With BSD sockets, I could determine which interface would be used to
communicate with a given host (and get the right gateway) as follows:

  Binding a UDP endpoint to 0.0.0.0
  Virtually connect() to the desired IP
  Calling getsockname() to see what it bound to.

This worked and didn't generate any network traffic. Unfortunately,
OT is too smart and doesn't let me connect a connectionless endpoint.
I also looked at the reachability stuff, but didn't see anything
obvious.

How do I determine which gateway to ping to perform port-mapping,
short of broadcasting or pinging each one?

Matt Slot / Bitwise Operator / Ambrosia Software, Inc.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com


This email sent to email@hidden

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Finding preferred interface
  • Next by Date: Re: Why would CFReadStreamSetProperty return FALSE? - Resolved
  • Previous by thread: Finding preferred interface
  • Next by thread: Re: Why would CFReadStreamSetProperty return FALSE? - Resolved
  • Index(es):
    • Date
    • Thread