SampleD failure with dynamic SockServiceName
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
David, What version of the OS are you on? davez On Jun 5, 2008, at 1:12 PM, David Anderson wrote:
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 _______________________________________________ launchd-dev mailing list launchd-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev
At 9:01 -0700 6/6/08, Dave Zarzycki wrote:
What version of the OS are you on?
Just to close the loop an this one, and document it for the record, there was a bug in launchd that prevents this (Bonjour registration of an anonymous port) from working prior to 10.5. If you want Bonjour registration to work on 10.4.x, you'll have to use a fixed port number )-: S+E -- Quinn "The Eskimo!" <http://www.apple.com/developer/> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
participants (3)
-
Dave Zarzycki
-
David Anderson
-
Quinn