Re: recvmsg() in Tiger
Re: recvmsg() in Tiger
- Subject: Re: recvmsg() in Tiger
- From: Will Mason <email@hidden>
- Date: Thu, 12 May 2005 16:08:58 -0700 (PDT)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
> int comms[2];
> pipe(comms);
>
> struct msghdr msg ;
> ... fill msg
> ssize_t bytesRead = recvmsg( comms[0], &msg, 0 );
>
> In Panther the program now waits until some data arrives on the pipe.
>
> But Tiger immediately tells me: "Socket operation on a non-socket".
> And, when I look at my code, this makes sense: a pipe probably is not
> a
> socket (not that I know the difference).
>
> So two questions:
> Why did this work on Panther?
> And (much more important): what do I have to do to make it work on
> Tiger?
You're right that a pipe is not a socket, though often pipes are
implemented with Unix domain sockets. Either Tiger changed the
implementation of pipe or just decided to get more strict with the
recvmsg() and sendmsg() calls. They're right about that, by the way, as
recvmsg() and sendmsg() don't claim to work with non-sockets, so if
they do it's just a happy coincidence.
The solution to your problem, though, is just to use normal read() and
write() calls that take file descriptors, as these functions should
work with pipes. If they don't, then something is really wrong. This
shouldn't be a problem in your case, you're not using any flags on the
recvmsg() call, anyway.
Take care,
Will
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden