1 / 8

.NET Remoting

.NET Remoting. A Distributed Application Cookbook. Agenda. Brief overview of Remoting Technicalities for creating a distributed application based on Remoting Examples will be uploaded to the course site. Remoting. RMI – Remote Method Invocation (JAVA) RPC – Remote Procedure Call (.NET).

love
Download Presentation

.NET Remoting

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. .NET Remoting A Distributed Application Cookbook

  2. Agenda • Brief overview of Remoting • Technicalities for creating a distributed application based on Remoting • Examples will be uploaded to the course site

  3. Remoting • RMI – Remote Method Invocation (JAVA) • RPC – Remote Procedure Call (.NET) Costumizable! Client Server Remote invocation f y f(x) Object h On runtime transparent to client Standard development syntax

  4. Step 1 – Miscellaneous • Create three modules • A client module • Holds client code • Will ultimately run the client process (console application) • A server module • Holds server code • Will ultimately run the server process (console application) • A commonlibrary • This module contains all the declarations\definitions that are common to the client and the server (DLL)

  5. Step 2 – Creating the remote object • In the common library module Declare an interface exposing your remote objects methods • In the server module, declare the object’s class extendingMarshalByRefObject and implementing the interface

  6. Step 3 – Hosting the object • The object is hosted in the server process • Programmatically: • Using a configuration file SoapServerFormatterSinkProvider server = newSoapServerFormatterSinkProvider(); server.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; IDictionary prop = newHashtable(); prop["port"] = 9999; ChannelServices.RegisterChannel(newHttpChannel(prop, null, server), false); RemotingConfiguration.RegisterWellKnownServiceType( Type.GetType("Server.Program, Server"), "Service", WellKnownObjectMode.Singleton);

  7. Step 4 – Instantiation at the client • The object is instantiated and accessed in the client process • Programmatically: • Using a configuration file SoapServerFormatterSinkProvider server = newSoapServerFormatterSinkProvider(); server.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; IDictionary prop = newHashtable(); prop["port"] = 0; //listens on an arbitrary port ChannelServices.RegisterChannel(newHttpChannel(prop, null, server), false); Common.IService service = (Common.IService)Activator.GetObject(typeof(Common.IService), "http://localhost:9999/Service");

  8. Custom Sinks • A class implemeting the sink • Extend BaseChannelSinkWithProperties • Implement IClientChannelSink or IserverChannelSink • Implement IMessageSink if placed before the formater sink • A sink provider class • Implementing IClientChannelSinkProvider or IServerChannelSinkProvider • Actually passed to the channel

More Related