site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Nov 30, 2004, at 12:58 PM, Mark Gilbert wrote: _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... Also, I am creating (in C) an HTML web page with a 'refresh' line, to make the page automatically reload every 2 seconds (to generate a live update of status). In order to do that I have to code my own IP address into the HTML which I return to the client. In this case I would use getsockname() as another person responding suggested. Since you already have a connection with the web client, you now know which interface is being used with it. If you do this per connection, then you will work rather reliably in most cases. Even if there are multiple interfaces or your assigned address changes. So, first of all, I would like to have a status window in my app's GUI which tells a local user which address they need to enter remotely to control the app (without having to look elsewhere in the computer to find it). As has been stated before there is no 100% reliable or sensible way to do that. You may well have multiple interfaces to separate networks which don't route. If you are trying to emulate what the sharing panel does, it uses the fqdn if the system has one, otherwise I believe (maybe wrongly) it uses the IP address of the interface with highest "priority" as specified in the network panel. You could do a best guess by using gethostname() and then resolving the result with gethostbyname(), but that assumes a network where host names have been assigned and are resolvable in DNS. This really is one of the main reasons DNS exists in the first place :). You could also advertise your service in Rendezvous and let clients find you. This email sent to site_archiver@lists.apple.com
participants (1)
-
Paul Forgey