Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Launchd and domain sockets, accept() problem (was Re: launchd APIs)



On Apr 21, 2006, at 1:24 PM, Dave Zarzycki wrote:
Sorry, no documentation has been written as of yet. That's all my fault.

Do you have any questions you'd like answered?

I've got a domain socket that the daemon listens on for IPC.

Internally it takes a socket FD and uses it as an argument to CFSocketCreateWithNative with an accept callback.

This works fine if the daemon initializes the socket itself.

Using launchd, it doesn't work. Clients appear to connect to the socket, but the accept callback is never called.

There *is* a socket in the dictionary. Here's the code the daemon calls to get the socket. I've cut out all of the error handling code. There *aren't* any errors, so it's not really relevant. This is pretty much straight from sampled, except that since I have exactly one socket I don't need a loop:

sockets_dict = launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_SOCKETS);
listening_fd_array = launch_data_dict_lookup(sockets_dict, "DaemonDomainSocket");
if (0 < launch_data_array_get_count(listening_fd_array)) {
launch_data_t this_listening_fd = launch_data_array_get_index (listening_fd_array, i);
listener_fd = launch_data_get_fd(this_listening_fd);
}


Then listening_fd is used as the socket passed to CFSocketCreateWithNative. I've checked that the socket is being created, in the right location with the right permissions.

in the plist file for that socket I've got:

	<key>SockFamily</key>
	<string>Unix</string>
	<key>SockPassive</key>
	<true/>
	<key>SockPathMode</key>
	<integer>49663</integer> -- this corresponds to 140777 octal...
	<key>SockPathName</key>
	<string>/var/tmp/com.deterministicnetworks.daemon/Socket</string>

Is launchd handling the accepts? If so, how do I find out when something has been accepted? If not, do you have any idea what's going on with launchd here?

Kevin Brock
email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >launchd APIs (From: Kevin Brock <email@hidden>)
 >Re: launchd APIs (From: Dave Zarzycki <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.