[launchd-dev] How to on demand launch for configurable port number?

Quinn eskimo1 at apple.com
Tue Apr 1 04:23:39 PDT 2008


At 22:15 +0100 29/3/08, Mike Fischer wrote:
>Currently I'd immagine that I need to 'launchctl stop' the service, 
>modify the associated launchd.plist to reflect the currently 
>configured port and then 'launchctl start' the service.

You would probably have to "unload" and "load", rather than "stop" 
and "start".  Stop/start just affects the running process, so launchd 
will not reconsult the relevant plist file.

>Unless of course there is a better way that doesn't involve changing 
>the launchd.plist?

I can't think of one.

>Not sure if this is relevant but the daemon does not use Bonjour at 
>the moment to advertise its service. That could be added though (and 
>might be a good idea for other reasons).

If you used Bonjour, you could just bind to a ephemeral port 
("SockServiceName" == "0") and find the service, which includes the 
port, using Bonjour.  No need for fixed ports at all.

S+E
-- 
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware


More information about the launchd-dev mailing list