Re: File access questions

Nathan Sims <[email protected]> Wed, 16 Nov 2011 12:52:25 -0800
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On Nov 16, 2011, at 12:18 PM, Kyle Sluder wrote:

> On Wed, Nov 16, 2011 at 12:03 PM, Nathan Sims
> <[email protected]> wrote:
>> Wow, I didn't know about Unix domain sockets, but this seems to be a =
perfect fit. I can make the Cocoa process into a mini UDP server on a =
known sun_path, and the C processes can get the temp data from it by =
sending a request to the same sun_path and reading the response packet, =
all without connecting. That should be a little more elegant than using =
files.
>=20
> Technically it's not using UDP, since that's a protocol built on top
> of IP (Internet Protocol) and thus only applicable to AF_INET sockets.
> My guess is you want to use SOCK_SEQPACKET.

Hmm, isn't SOCK_SEQPACKET connection-oriented? If I use SOCK_DGRAM =
instead wouldn't that be a lot easier and lighter-weight, not having =
connections? I was going to do:

    socket_fd =3D socket(AF_UNIX, SOCK_DGRAM, 0)

on both sides and then use recvfrom() and sendto() without connection on =
either side, which is about as simple as it gets, since all processes =
are on the same machine...