• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Does sendmsg only work on AF_UNIX sockets?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does sendmsg only work on AF_UNIX sockets?


  • Subject: Re: Does sendmsg only work on AF_UNIX sockets?
  • From: Dave Camp <email@hidden>
  • Date: Thu, 13 Nov 2008 15:31:12 -0800

On Nov 13, 2008, at 1:05 PM, Josh Graessley wrote:
On Nov 13, 2008, at 1:05 AM, Dave Camp wrote:
On Nov 12, 2008, at 4:12 PM, james woodyatt wrote:
On Nov 12, 2008, at 15:48, Dave Camp wrote:
Just to confirm, that was the source of my question... I've got two unrelated processes (not a parent/child relationship), neither can write to a common part of the file system and I want to pass a file descriptor from one to the other. My research was showing there wasn't a way to do it, but I thought I'd ask anyway.

How is it possible that one or both of your processes do not have rwx permissions on the /tmp directory? Did you do something with chroot(8) that you're not telling us? If so, then Don't Do That. Make sure the processes a have a common path to an AF_UNIX socket where you can pass file descriptors between them.

It's on a iPhone, that's how.

I didn't mention it because it wasn't relevant to the general question of "is AF_UNIX the only way to pass a file descriptor"... I apologize if that made your brain hurt.:-)

This answer inevitably leads to more questions.

What precisely are you trying to accomplish. For the most part, only a single iPhone app may run at a time. Are you trying to pass file descriptors between two different iPhone apps? Are you trying to run another process from your iPhone app? More information may help us determine if there's a way for you to solve your problem that will work on the iPhone.

Unfortunately, my company doesn't want me to go into more detail about how we are pulling this off on the iPhone, even though it's completely above board and not violating the SDK license, for fear of app store rejection. Insert rant about the chilling effect of random app store rejections here...


I can summarize my problem thusly:
- I have two unrelated processes running on the iPhone.
- I need to move a file of reasonable size (up to 15-20 MB) from one app to the other. Both apps are consenting in this data exchange, no hackery going on.
- The iPhone sandboxes apps such that they cannot write to common areas of the phone or read from other application sandboxes.
- The the sending app has about 5 seconds to get all the data across.


I have code working that sends the data with basic BSD socket code, but I can't seem to get more than about 2MB/s with plain C socket code on the phone, whereas the same code gets like 200MB/s in the simulator. So, in the time I have available to get the data across I can only get about 10MB transferred. I'd like to get that number up to 15-20MB.

My first idea was to send an open file descriptor over via a AF_UNIX socket, but that requires the ability to read/write to a common location on the filesystem from what I can tell. If the receiving app was able to read from the file descriptor after the sending process terminated I would no longer have a time constraint.

Next idea was to send the file descriptor over a local AF_INET socket, but you can't do that (my original question).

I briefly considered SysV shared memory, but that looks like pure evil. The docs I've read indicate accidentally leaking a SysV shared memory space lasts until the next reboot. That would be real bad.

I have not looked at mach ports yet.


If anyone has other great ideas I should try, please let me know. I'll code them up and see what sticks...


Thanks,
Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Does sendmsg only work on AF_UNIX sockets?
      • From: Josh Graessley <email@hidden>
References: 
 >Does sendmsg only work on AF_UNIX sockets? (From: Dave Camp <email@hidden>)
 >Re: Does sendmsg only work on AF_UNIX sockets? (From: "Justin C. Walker" <email@hidden>)
 >Re: Does sendmsg only work on AF_UNIX sockets? (From: Quinn <email@hidden>)
 >Re: Does sendmsg only work on AF_UNIX sockets? (From: Dave Camp <email@hidden>)
 >Re: Does sendmsg only work on AF_UNIX sockets? (From: james woodyatt <email@hidden>)
 >Re: Does sendmsg only work on AF_UNIX sockets? (From: Dave Camp <email@hidden>)
 >Re: Does sendmsg only work on AF_UNIX sockets? (From: Josh Graessley <email@hidden>)

  • Prev by Date: Re: Does sendmsg only work on AF_UNIX sockets?
  • Next by Date: Re: Does sendmsg only work on AF_UNIX sockets?
  • Previous by thread: Re: Does sendmsg only work on AF_UNIX sockets?
  • Next by thread: Re: Does sendmsg only work on AF_UNIX sockets?
  • Index(es):
    • Date
    • Thread