• 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: threaded/forking server and distributed objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: threaded/forking server and distributed objects


  • Subject: Re: threaded/forking server and distributed objects
  • From: James Bucanek <email@hidden>
  • Date: Wed, 12 Jul 2006 22:36:56 -0700

Tyler Riddle wrote on Wednesday, July 12, 2006:
>I've got my vended object which clients can connect to and send
>messages to, no problem there. In my server, once I get a request for
>a command I want to fork() off another process (similar to creating a
>thread just to handle the request). Now the trouble starts: what ever
>the vended object returns goes right to the client. If I fork (or
>create a thread to handle the task) I've got to return nothing in the
>main process (can this be done with distributed objects?) and only
>return data  and let the created process/thread return the useful
>value to the client.
>
>Did that make sense? Am I barking up the wrong tree with distributed objects?

As far as I know, you can't "hand off" an NSConnection to a new process. You can do this between threads (with some fiddling), but not between processes.

I see two obvious solutions.

1) Let the secondary process create another NSConnection to the tertiary process, then act as a pass-through. It would obtain the root proxy object from the tertiary process, pass the message it was passed from the client, and return the results. The client will essentially have a proxy of a proxy of an object. (Let's hope you don't have a lot of messages going through that!) This might even require creating a thread in the secondary process so that the connection between the client and tertiary process doesn't block the main thread.

2) Tell the client to create a new connection. This is what I do in my application. The client connects with the server and tells it to start a new process. The server creates a new process and assigns it a (random) NSConnection name. The server returns that connection name to the client. The client can then connect to the new process directly and bang away until it's done.

--
James Bucanek
 _______________________________________________
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

References: 
 >threaded/forking server and distributed objects (From: "Tyler Riddle" <email@hidden>)

  • Prev by Date: Re: threaded/forking server and distributed objects
  • Next by Date: NSOutlineView edit row problem
  • Previous by thread: Re: threaded/forking server and distributed objects
  • Next by thread: NSOutlineView edit row problem
  • Index(es):
    • Date
    • Thread