Confused about sockets - please help!
Hi, I'm writing a library API to manipulate launchd plists (from Ruby). But after reading and re-reading the man page, still very uncertain whether theres any difference between: Sockets <dictionary of dictionaries... OR dictionary of array of dictionaries...> Are all of these different possible structures interchangeable? (ie meaning the same thing to launchd program?) For example: <key>Sockets</key> <dict> <key>Listeners</key> <array> <dict> <key>SockNodeName</key> <string>::1</string> <key>SockServiceName</key> <string>ipp</string> </dict> <dict> <key>SockNodeName</key> <string>127.0.0.1</string> <key>SockServiceName</key> <string>ipp</string> </dict> <dict> <key>SockPathMode</key> <integer>49663</integer> <key>SockPathName</key> <string>/private/var/run/cupsd</string> </dict> </array> </dict> or <key>Sockets</key> <dict> <key>listener1</key> <dict> <key>SockNodeName</key> <string>::1</string> <key>SockServiceName</key> <string>ipp</string> </dict> <key>listener2</key> <dict> <key>SockNodeName</key> <string>127.0.0.1</string> <key>SockServiceName</key> <string>ipp</string> </dict> <key>listener3</key> <dict> <key>SockPathMode</key> <integer>49663</integer> <key>SockPathName</key> <string>/private/var/run/cupsd</string> </dict> </dict> or <key>Sockets</key> <dict> <key>listener1</key> <array> <dict> <key>SockNodeName</key> <string>::1</string> <key>SockServiceName</key> <string>ipp</string> </dict> </array> <key>listener2</key> <array> <dict> <key>SockNodeName</key> <string>127.0.0.1</string> <key>SockServiceName</key> <string>ipp</string> </dict> </array> <key>listener3</key> <array> <dict> <key>SockPathMode</key> <integer>49663</integer> <key>SockPathName</key> <string>/private/var/run/cupsd</string> </dict> </array> </dict> I'd really love to get an answer here, as its the last thing needed to complete the API interface. Best regards dreamcat4 dreamcat4@gmail.com
At 20:19 +0000 2/3/10, dreamcat four wrote:
Are all of these different possible structures interchangeable?
It depends on your perspective. From the perspective of launchd, it doesn't care which format you use. From the perspective of a launchd daemon developer, each format offers unique advantages. o If the sockets perform distinct functions, the dictionary of dictionaries approach lets the launchd daemon easily determine which socket is which. o If the sockets perform similar functions, Tthe dictionary of array of dictionaries approach makes that obvious. If you're writing a tool to manipulate launchd plists, I'd recommend that you work hard to preserve this distinction. A launchd daemon that expects its checkin results to be in one one format is probably going to fail if they are in the other. S+E -- Quinn "The Eskimo!" <http://www.apple.com/developer/> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
participants (2)
-
dreamcat four
-
Quinn