[launchd-dev] SampleD failure with dynamic SockServiceName

David Anderson dwa at mac.com
Thu Jun 5 13:12:50 PDT 2008


My intention is have launchd start a daemon on a dynamic port, publish  
the port number via bonjour, and then connect to this port after  
determining the port number using CFNetService (Bonjour).

Starting from SampleD (and using the included client.pl), I can  
advertise the service on a hard-coded port via bonjour, lookup the  
port number using Bonjour Browser, modify client.pl to use this port,  
and connect using client.pl.  The SampleD binary starts correctly in  
an OnDemand fashion correctly.

If I change
<key>SockServiceName</key>
<string>12345</string>

to
<key>SockServiceName</key>
<string>0</string>

then lookup the dynamic port number using Bonjour Browser and  
configure client.pl to use this port, client.pl will NOT connect to  
this port and outputs this error:

connect: Connection refused at ./client.pl line 77.

With a dynamic port, I am unable to connect to this port using a  
modified client.pl.  I can find no evidence that the SampleD binary is  
starting in an OnDemand fashion.

Adding
<key>OnDemand</key>
<false/>
has no effect.

Is there anything different about the default configuration of a  
dynamic port vs a hard-coded port that would impeded the ability to  
connect to the dynamically assigned port?


Thanks,
Dave


More information about the launchd-dev mailing list