c# - .NET Remoting - How can the Server update the client? -


Right now, I am in the prototype phase, so I'm just starting.

Status: The server will run the test and the progress will be published in the client, there should be less effect, there will be no webserver, possibly running XP embedded or XP home.

> Customers - Start testing and get progress report Running XP Pro

Two machines are connected to Ethernet. I want to use .NET remoting to communicate between two machines, and I use events to update clients with new results. I want to do this, but I have read that incidents in these situations are unbelievable how should I do this? Can the server connect to the client and use remoting to publish events? Will it work fine?

I used the system once the remoting was used, and where the server used some events Launched on which client can subscribe.

To make this possible, you have to set the typefilter level fully, and you will have to create an 'intermediate' object known on the client and on the server to be able to handle your event .

For example: this is the class that is known on the server & amp; On the client side.

  Public abstract class MyDelegateObject: MarshalByRefObject {public void EventHandlerCallback (Object Sender, EventArgs E) {EventHandlerCallbackCore (Sender, E); } Safe Essence void EventHandlerCallbackCore (Object Sender, EventArgs e); Public Override Object Initial Life Service () {Return Null; }}  

In the customer-side, you create another class that comes from the above class, and applies the actual argument that should be done when the event is picked up.

  Public category MyConcreteHandler: MyDelegateObject {protected override EventHandlerCallbackCore (object sender, EventArgs e) {// some stuff}}  

Attach event to the remote object like this:

  MyConcreteHandler handler = New MyConcreteHandler (); MyRemoteObject.MyEventOccured + = New EventHandler (Handler. Avenver Callback);  

OffCourse, if you update the Winform control in your EventHandler class, then that class must also apply the ISInconvenience invoke.


Comments