Re: Problem In Accessing NSDistantobject
Re: Problem In Accessing NSDistantobject
- Subject: Re: Problem In Accessing NSDistantobject
- From: Mike Bellerby <email@hidden>
- Date: Wed, 9 Jan 2008 11:19:33 +0000
Hi Abu
The standard way to use a distributed object is to create and use the
proxy within your main thread, not to create a separate thread to do
this. Which if I have understood you correctly is what you are trying
to do. Simply use the following.
//get connection
myConnection = [[NSConnection connectionWithRegisteredName:@"myname"
host:nil] retain];
//set a sensible timeout
[myConnection setReplyTimeout:10];
//get proxy
myProxy = [[guiConnection rootProxy] retain];
... some code ...
id responce = [myProxy message];
... some more code..
responce = [myProxy onotherMessage];
Hope this helps
Mike
On 9 Jan 2008, at 04:40, Abdul Sattar wrote:
Hello All,
I have created an application which uses Bonjour and Distributed
Object (DO)to share files across the systems connected to the LAN,
I have an issue with DO connection.
That is I have created a NSConnection in a thread (say THREAD 1),
and get the mProxy (server vended object) using the call
[connection rootproxy] in the same thread.But when try to use
mProxy in another thread or in main thread, it raises an exception
saying "NSDistantObject access attempted from another thread",
documentation says this is due to my attempt to use mProxy which is
created in another thread (THREAD 1).
So what I have to do is keep running the THREAD 1 for long , and
send all subsequent function calls to mProxy in the same thread
(As I dont want to create separate thread and separate nsconnection
for each function call to mProxy, instead use the same thread
THREAD 1 for all the time.).
Can anybody please tell me, how to send request to mProxy (in my
case) to execute remote methods using single thread which keeps
running, or sending request for invoking a method to already
running thread or Any alternate way for my above problem (my be
sample code).
Please correct me if I am doing anything wrong in my above
explained scenario.
Thanks in advance.
With Regards,
Abu
-----------------------------------------------
Robosoft Technologies - Come home to Technology
Disclaimer: This email may contain confidential material. If you
were not an intended recipient, please notify the sender and delete
all copies. Emails to and from our network may be logged and
monitored. This email and its attachments are scanned for virus by
our scanners and are believed to be safe. However, no warranty is
given that this email is free of malicious content or virus.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden