Groups | Blog | Home
all groups > dotnet remoting > september 2006 >

dotnet remoting : Getting at Service object from remoted object?



Grant Schenck
9/13/2006 8:41:07 AM
Hello,

I have a Windows Service developed in C# .NET. I'm making it a remote
server and I can, via an IPC Channel, expose methods on an object and call
them from a
client. However, I now want my remoted object to be able to invoke a method
on my server object and given that the object is built in a C# Class DLL
shared between the client and server I'm not sure how to get access to the
server object from the remoted object.

So, what techniques are commonly used to allow this?

Thanks,
--
Grant Schenck

Grant Schenck
9/13/2006 9:17:33 AM
Hi,

See below.

Thanks, Grant Schenck

----- Original Message -----
From: "Nicholas Paldino [.NET/C# MVP]" <casperOne@caspershouse.com>
To: <schenckg@optonline.net>
Sent: Wednesday, September 13, 2006 8:41 AM
Subject: Re: Getting at Service object from remoted object?


[quoted text, click to view]

[GRANT] Right, I need a reference to my Service object.

[quoted text, click to view]

[GRANT] If I create a form from one form, I can pass the first form to the
second form. However, the remoting object isn't created until the client
invokes the remoted object method so I'm confused as to how the server could
get access to the object between when it is created and when the method is
invoked. Part of my confusion is I'm not clear how my remoted object, built
as a C# DLL class, can be able to call methods in my Service object.

[quoted text, click to view]

[GRANT] Are you saying I should derive my Service class from
MarshallByRefObject (as well as ServiceBase) and somehow this object would
be a singleton for all clients, i.e., my remoted object IS my service???

[quoted text, click to view]

[GRANT] Actually I don't. My goals seem simple.

- I have a service running (controls a phone system but not particularly
relevent)
- I want to remote a single method (MakeCall)
- Client applications will invoke this method and pass a few parameters.
- Service will "get" these requests, presumably each on its own thread and
able to overlap, and via appropirate protection, service the request.
- Serving the request takes real time so using IPC (thanks from yesterday!)
the method blocks waiting for the async work to complete.
- At some point the work completes and the service will then release the
client method call thread and let it return the results.

So, I only want to expose one method from my server.

[quoted text, click to view]

James Westgate
9/13/2006 2:58:35 PM
You need to bear in mind that the client will be creating a reference to
a remote object, which it then references as if it were local.
I highly recommend a book by Ingo Rammer on .NET remoting which walks
through all of these scenarios and will allow you to choose the best
techniques for accessing objects remotely, and calling methods.

Best wishes
James

http://www.crainiate.net


[quoted text, click to view]
Spam Catcher
9/13/2006 7:08:51 PM
"Grant Schenck" <schenckg@optonline.net> wrote in
news:#ziLcFz1GHA.1304@TK2MSFTNGP05.phx.gbl:

[quoted text, click to view]

RemotingService.Marshal(ObjectReference)

(ykozlov NO[at]SPAM pc-studio.com)
9/28/2006 3:24:08 AM
Hi Grant,

all you really need is reference to server object within your remote object.

AddThis Social Bookmark Button