Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get client IP address assigned by Cisco VPN client



--- At Thu, 20 Apr 2006 13:33:57 -0700, Josh Graessley wrote:

>* PGP Signed by an unverified key: 04/20/06 at 13:33:58
>
>While this may not help with the Cisco VPN, you should consider  
>asking the stack itself what the local IP addresses are, not system  
>config. It is possible that people may use ifconfig to bypass system  
>config and your software should do its best to live in this  
>environment. There is one other bit to keep in mind, the local  
>address will depend on the destination. Some VPNs are set to only  
>route traffic to a certain subnet. There are two good ways to get  
>this information. The first is to connect a socket, forcing the stack  
>to pick a local address to bind to. You can get the local address  
>using getsockname. The other good way to do this is to use a routing  
>socket to get the route entry for a destination address you are  
>interested in. If you are simply interested in listening for inbound  
>connections on all local addresses, your best bet is to either bind  
>to the INADDR_ANY address (all zeros) or use getifaddrs to get a list  
>of the local addresses to bind to.

I have an interesting situation that I've been trying to solve.

I have a small http server open on a socket. But I need to send a
message to another machine that indicates what the address is that they
are to connect to in order to use this http server. The information is
specified to be a complete URL.

I open the listening socket for the http server using INADDR_ANY. When I
use getsockname() I get INADDR_ANY (ie 0 (I think)) for the IP address.
Needless to say, this isn't useful.

What is the best way for me to get the IP address that the other end
would use? Would a routing socket be the best way? But doesn't that
require root/authenticated access? Is there another, simpler way?

Thanks,

 ...Duane

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

This email sent to email@hidden

References: 
 >How to get client IP address assigned by Cisco VPN client (From: Martin Bestmann <email@hidden>)
 >Re: How to get client IP address assigned by Cisco VPN client (From: Josh Graessley <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.