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,
>
> The object you expose through remoting is an object, nothing more, nothing
> less. To that end, you can expose properties, methods, fields,
> etc, etc, that will allow it to access the server, assuming that your
> object
> has a reference to it.
[GRANT] Right, I need a reference to my Service object.
[quoted text, click to view] > So how does your object get access to the server? This is the same
> as asking how a form has access to another form. You set a reference
> through a method, the constructor, a field, or a property.
[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] > The only consideration here is that if you expose a property with
> your service object through remoting, is it going to be marshaled by
> value,
> or by reference? Something tells me you will want it to be marshaled by
> reference, in which case you will want to derive your server class from
> MarshalByRefObject.
[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] > Not seeing your service object design, I can't tell if it is a good
> idea to expose the whole object. You might be exposing things you don't
> want
> to.
[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] > Hope this helps.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@spam.guard.caspershouse.com
>
> "Grant Schenck" <schenckg@optonline.net> wrote in message
> news:Oj6Ar5y1GHA.4484@TK2MSFTNGP02.phx.gbl...
>> 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 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
>>
>>
>
>