Ben Fidge
10/11/2004 5:40:00 PM
Thanks Ken, that is exactly what I'm looking for.
"Ken Kolda" <ken.kolda@elliemae-nospamplease.com> wrote in message
news:ujRV1J7rEHA.1816@TK2MSFTNGP15.phx.gbl...
> Assuming your server object is a singleton, this is pretty
> straight-forward
> to implement. As you mentioned, the first step is to expose an event off
> of
> your server object so your host app can hook into it and receive feedback.
> Once you have that, the next key step is to manually marshal your server
> using RemotingServices.Marshal(). For example:
>
> // Entry point of your host app
> public static Main()
> {
> // Register your remoting channel
> ChannelServices.RegisterChannel(new TcpChannel(2000));
>
> // Create an instance of your server object
> ServerObject obj = new ServerObject();
>
> // Register for the feedback events
> obj.Feedback += new FeedbackEventHandler(myEventHandler);
>
> // Marshal the object
> RemotingServices.Marshal(obj, "Server.rem");
> }
>
> Now, from the client, you can access the server as follows:
>
> ServerObject server = (ServerObject)
> Activator.GetObject("tcp://localhost:2000/Server.rem");
>
> In other words, don't use the RegisterWellKnownServerObject() method or a
> <wellknown> tag in your config file -- if you use these, the remoting
> infrastructure handles the instantiation of the object and it's harder to
> get direct access. By marshalling the object yourself, your host can
> reference the same instance as your remote clients.
>
> Hope that helps -
> Ken
>
>
>
>
>
> "Ben Fidge" <ben.fidge@btopenworld.com> wrote in message
> news:%23E423wwrEHA.3076@TK2MSFTNGP10.phx.gbl...
>> Hi
>>
>> I want my remoting server object to be able to provide feedback to the
>> Win
>> Forms based task tray application that is hosting it. When a client
> executes
>> a method on the server, I want the server to notify it's host application
> so
>> it, in turn, can then display information in a pop-up window. I don't
>> want
>> the pop-up window to be included in the server object implementation.
>>
>> I'm new to remoting and can't figure out how to provide feedback from the
>> remoting server object instance to it's host app. I suspect I'm missing
>> something obvious here! Ideally, I'd like to provide an event in the
> server
>> object class that the host app then subscribes to to receive
> notifications.
>>
>> Thanks in advance
>>
>> Ben
>>
>>
>
>