Distributed Systems Tutorial 2 -.NET Remoting. 2 What is Remoting?  Remoting allows you to pass objects or values across servers in different domains.

Slides:



Advertisements
Similar presentations
Message Passing Vs Distributed Objects
Advertisements

.NET Remoting in Delphi and C# Alain “Lino” Tadros President & CEO Falafel Software Inc. ComponentScience Inc. BORCON 2004.
.Net Remoting Pooja Panjala 06/17/10. Agenda What is.net Remoting? Explanation of terms Architecture Implementation of Remoting Sample example.net Security.
C# and Windows Programming Application Domains and Remoting.
.NET REMOTING CertSIG Tom Perkins. FUNDAMENTALS Distributed Applications Process A Process B Process C Objects can communicate across process boundaries.
Author: Bill Buchanan. Authentication (to identify the clients of your application) Authorization (to provide access controls for those clients) Secure.
.NET Remoting. .Net Remoting Replaces DCOM (Distributed Component Object Model – a proprietary Microsoft technology for communication among software components.
Remote Method Invocation
6/11/2015Page 1 Web Services-based Distributed System B. Ramamurthy.
1 Advanced Programming Topics - II Objectives:  Background  Remoting  Types of remoting  Marshalling  Farmatters  Channels.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
DISTRIBUTED FILE SYSTEM USING RMI
Tutorials 2 A programmer can use two approaches when designing a distributed application. Describe what are they? Communication-Oriented Design Begin with.
1 Java Networking – Part I CS , Spring 2008/9.
Client Server Model The client machine (or the client process) makes the request for some resource or service, and the server machine (the server process)
Communication in Distributed Systems –Part 2
Distributed Systems Tutorial 3 -.NET Remoting – Crossing Application Boundaries.
INTRODUCTION TO WEB SERVICES CS 795. What is a Web Service ? Web service is a means by which computers talk to each other over the web using HTTP and.
Web Proxy Server Anagh Pathak Jesus Cervantes Henry Tjhen Luis Luna.
Chapter 26 Client Server Interaction Communication across a computer network requires a pair of application programs to cooperate. One application on one.
FTP File Transfer Protocol. Introduction transfer file to/from remote host client/server model  client: side that initiates transfer (either to/from.
Process-to-Process Delivery:
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
.NET Remoting Architecture. Slide 2 CITE 4420.NET Remoting Topics Remoting Boundaries Crossing the Boundaries Distributed Applications Marshalling Channels.
.Net Remoting. 2 Distributed Computing under.Net In.Net, there are three levels of access to distributed computing machinery: In.Net, there are three.
11 Copyright © 2005, Oracle. All rights reserved. Configuring the Oracle Network Environment.
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
CSCI 6962: Server-side Design and Programming Web Services.
LAB 1CSIS04021 Briefing on Assignment One & RMI Programming February 13, 2007.
IBM TSpaces Lab 1 Introduction. Summary TSpaces Overview Basic Definitions Basic primitive operations Reading/writing tuples in tuplespace HelloWorld.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
Fundamentals of Proxying. Proxy Server Fundamentals  Proxy simply means acting on someone other’s behalf  A Proxy acts on behalf of the client or user.
Copyright © 2003, developerLabs Extending.NET Distributed Applications Stephen Fulcher developerLabs.
Application Block Diagram III. SOFTWARE PLATFORM Figure above shows a network protocol stack for a computer that connects to an Ethernet network and.
Systems Prog. & Script. - Heriot Watt Univ 1 Systems Programming & Scripting Lecture 11: The Distributed Object Model.
RMI remote method invocation. Traditional network programming The client program sends data to the server in some intermediary format and the server has.
XML Web Service. Overview of XML Web Service ASP.NET XML Web services enable you to remotely access the properties and methods of classes across a network.
Security, NATs and Firewalls Ingate Systems. Basics of SIP Security.
.Net Remoting The Other RPC Architecture Doug Gregory October 27, 2003.
1 Developing Application in Distributed Computing Environment (DCE)
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
Intro to Web Services Dr. John P. Abraham UTPA. What are Web Services? Applications execute across multiple computers on a network.  The machine on which.
Computer Communication: An example What happens when I click on
 Java RMI Distributed Systems IT332. Outline  Introduction to RMI  RMI Architecture  RMI Programming and a Sample Example:  Server-Side RMI programming.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
1 Nordjyllands Erhvervakademi Net Remoting Architecture Marshalling –Marshalling By Reference(MBR) –Marshalling By Value(MBV) Activation by MBR.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 29 Remote Method.
.NET Remoting. Remoting Introduction The process of programs or components interacting across certain boundaries either different processes or machines.
Jim Fawcett CSE775 – Distributed Objects Spring 2003
Presented by: Ramaswamy Krishnan-Chittur
.NET Remoting Priyanka Bharatula.
Chapter 5 Remote Procedure Call
Remote Method Invocation
Presentation 23 .NET Remoting Introduced
Advanced .NET Programming II 10th Lecture
10: Remoting Securing System.Runtime.Remoting
Matt Smouse CSE775 – Distributed Objects Spring 2003
Presented by: Ramaswamy Krishnan-Chittur
NET323 D: Network Protocols
Chapter 3: Windows7 Part 4.
INTRODUCTION TO WEB SERVICES CS 795. What is a Web Service ? Web service is a means by which computers talk to each other over the web using HTTP and.
NET323 D: Network Protocols
Chapter 40 Remote Method Invocation
Creating a Distributed System with Remote Procedure Calls and Web Services Ch.5 B.Ramamurthy 2/17/2019 B.Ramamurthy.
Chapter 46 Remote Method Invocation
Distributed System using Web Services
Distributed System using Web Services
Matt Smouse CSE775 – Distributed Objects Spring 2003
Jim Fawcett CSE791 – Distributed Objects Spring 2002
Matt Smouse CSE775 – Distributed Objects Spring 2003
Presentation transcript:

Distributed Systems Tutorial 2 -.NET Remoting

2 What is Remoting?  Remoting allows you to pass objects or values across servers in different domains using several protocols.  Remoting enables client code in one application domain to call methods/properties of objects running in another application domain.

3 Remoting  If anyone configures the client properly, we need only to create a new instance of the remote object using the new keyword, then client receives a reference to the server object, and rest of the things are as usual (like invoking methods) as though the object were in your process though it is running on a separate computer.

4 Remoting in general  Server needs to publish an object  For example: I listen on this TCP channel and that HTTP channel I have a service called "MathService" When client connects to MathService using a supported channel, give the client the requested instance  Clients must connect to servers  Clients need to specify the desired object  For example: Connect to the "MathService" on server “X" using protocol HTTP on port 80

5 Building the sample application  In the below example, the remote object exposes two methods for adding and subtracting given two numbers.  Building an application that uses.NET Remoting to communicate across application domain boundaries is very straightforward: You must have an implementation of a remotable type. A listening or host application domain. A client or calling application domain. And you must configure the remoting system in each application domain to use remote activation for the remotable type.  The above process applies no matter how complex or simple the remoting scenario becomes.

6 Remoting Application Development Flow  Write the component(s) that you wish to make remotely accessible into a.NET DLL (Shared Assembly).  Configure any managed executable to host those components (Server Assembly)  Write the client(s) that call the components (Client Assembly).

7 Building Remotable Type  To enable objects in other application domains to use an instance of the class, the class must inherit from MarshalByRefObjet and then the runtime creates a proxy to the object  The following code example shows a simple object that can be created and invoked from objects executing in another application domain.

8 MathLibrary.cs using System; public class MathLibrary : MarshalByRefObject { private int result; public int AddTwoNumber(int num1, int num2) { result = num1 + num2; return result; } public int SubtractTwoNumber(int num1, int num2) { result = num1 - num2; return result; }}

9  Compile this file as a DLL from the command prompt  csc /noconfig /t:library MathLibrary.cs

10 Building a Host Application  To create instances of MathLibrary remotely, you must build a host or listener application which does two things: Choose and register a channel, which is an object that handles the networking protocols and serialization formats. Register MathLibrary with the.NET Remoting system so that it can use your channel to listen for requests for your type.  The following code implements a simple MathLibrary host application domain that uses a configuration file.

11 Listener.cs using System; using System.Runtime.Remoting; public class Listener { public static void Main() { RemotingConfiguration.Configure("Listener.exe.config"); Console.WriteLine ("Listening for requests. Press Enter to exit..."); Console.ReadLine(); }

12 Listener.exe.config <wellknown mode="Singleton" type="MathLibrary, MathLibrary" objectUri="MathLibrary.rem"/>

13  Another option is to do the following:  // Register a listening Channel  HttpChannel channel = new HttprChannel(8989);  ChannelServices.RegisterChannel(channel);  // Register a well-known type  RemotingConfiguration.RegisterWellKnownServiceType( typeof(MathLibrary), "MathLibrary.rem", WellKnownObjectMode.Singleton);

14  Store the code of Listener.cs in the same directory as where MathLibrary.dll is created.  Compile Listener.cs with reference to MathLibrary.dll as below: csc /noconfig /r:MathLibrary.dll Listener.cs  Since the code of Listener.cs uses Listener.exe.config file to listen to its remotable type, we need to create the Listener.exe.config file in the same directory where we created the Listener.exe.

15 Building a Client Application  Till now, we have created MathLibrary and the host application for Remoting.  Our application must register itself as a client for the remote object, and then invoke it as residing in the client application domain.  The.NET Remoting system intercepts the client calls, forwards them to the remote object, and returns the results to your client.

16 Client.cs using System; using System.Runtime.Remoting; public class Client { public static void Main() { RemotingConfiguration.Configure("Client.exe.config"); MathLibrary lib = new MathLibrary(); Console.WriteLine("Enter Number1:"); string num1 = Console.ReadLine(); Console.WriteLine("Enter Number2:"); string num2 = Console.ReadLine(); Console.WriteLine(lib.AddTwoNumber(Convert.ToInt16(num1), Convert.ToInt16(num2)).ToString()); Console.WriteLine ("Press Enter to exit..."); Console.ReadLine();}}

17  Compile Client.cs with reference to MathLibrary.dll as below:  csc /noconfig /r:MathLibrary.dll Client.cs  Since the code of Client.cs uses Client.exe.config file to listen to its remotable type, we need to create the Client.exe.config file in the same directory where we created the Client.exe

18 Client.exe.config <wellknown type="MathLibrary, MathLibrary" url=" />

19 Running the application  Now, every thing is ready to run your application:  Run Listener.exe  Run Client.exe

20 Backup  Disclaimer: The following slides were taken from

21 Client-side remoting  Client calls method on TransparentProxy  TransparentProxy builds message Stack frame to message  TransparentProxy passes msg to RealProxy  RealProxy forwards msg to envoy sink(s)  Last envoy sink forwards msg to context sink(s)  Last context sink forwards msg to channel sink(s)  Channel sinks turn message into a byte stream  Last channel sink sends byte stream to server

22 Server-side remoting  Channel receives a stream of bytes  Channel forwards stream to channel sink(s) Last channel sink converts stream into message  Last channel sink forwards msg to context sink(s)  Last context sink forwards msg to server sink(s) Last server sink is stack frame sink  Stack frame sink builds and issues call to requested method

23 Tx Sink Envoy Sink Envoy Sink Remoting chain Server object Envoy Sinks Message Transport Sink Channel Sink Channel Sink Channel Transport Sink Channel Sink Channel Sink Channel Stack Builder Sink Transparent Proxy Real Proxy Context Sinks Formatter Sink Client-side Server-side Message Formatter Sink Tx Sink Context Sinks Tx Sink Server Sinks …