SampleD failure with dynamic SockServiceName

View: New views
3 Messages — Rating Filter:   Alert me  

SampleD failure with dynamic SockServiceName

by David Anderson-23 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev

Re: SampleD failure with dynamic SockServiceName

by Dave Zarzycki :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
> http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev

_______________________________________________
launchd-dev mailing list
launchd-dev@...
http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev

Re: SampleD failure with dynamic SockServiceName

by Quinn-9 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
_______________________________________________
launchd-dev mailing list
launchd-dev@...
http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev