C# and Windows Programming Application Domains and Remoting.

Slides:



Advertisements
Similar presentations
Message Passing Vs Distributed Objects
Advertisements

COS 461 Fall 1997 Network Objects u first good implementation: DEC SRC Network Objects for Modula-3 u recent implementation: Java RMI (Remote Method Invocation)
Java Network Programming Vishnuvardhan.M. Dept. of Computer Science - SSBN Java Overview Object-oriented Developed with the network in mind Built-in exception.
SOAP.
.Net Remoting Pooja Panjala 06/17/10. Agenda What is.net Remoting? Explanation of terms Architecture Implementation of Remoting Sample example.net Security.
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
15-May-15 RMI Remote Method Invocation. 2 “The network is the computer” Consider the following program organization: If the network is the computer, we.
.NET REMOTING CertSIG Tom Perkins. FUNDAMENTALS Distributed Applications Process A Process B Process C Objects can communicate across process boundaries.
Distributed Object & Remote Invocation Vidya Satyanarayanan.
.NET Remoting. .Net Remoting Replaces DCOM (Distributed Component Object Model – a proprietary Microsoft technology for communication among software components.
Implementing Remote Procedure Calls Andrew Birrell and Bruce Nelson Presented by Kai Cong.
Advanced Programming Rabie A. Ramadan Lecture 4. A Simple Use of Java Remote Method Invocation (RMI) 2.
Remote Method Invocation
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.
1 HANDOUT 14 Remote Method Invocation (RMI) BY GEORGE KOUTSOGIANNAKIS THIS DOCUMENT CAN NOT BE REPRODUCED OR DISTRIBUTED WITHOUT TH E WRITTEN PERMISSION.
CORBA Case Study By Jeffrey Oliver March March 17, 2003CORBA Case Study by J. T. Oliver2 History The CORBA (Common Object Request Broker Architecture)
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
Sockets  Defined as an “endpoint for communication.”  Concatenation of IP address + port.  Used for server-client communication.  Server waits for.
Distributed Systems Tutorial 2 -.NET Remoting. 2 What is Remoting?  Remoting allows you to pass objects or values across servers in different domains.
Introduction to Remote Method Invocation (RMI)
Systems Architecture, Fourth Edition1 Internet and Distributed Application Services Chapter 13.
2 Systems Architecture, Fifth Edition Chapter Goals Describe client/server and multi-tier application architecture and discuss their advantages compared.
Distributed systems (NET 422) Prepared by Dr. Naglaa Fathi Soliman Princess Nora Bint Abdulrahman University College of computer.
Distributed Systems Tutorial 3 -.NET Remoting – Crossing Application Boundaries.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
.Net Remoting. 2 Distributed Computing under.Net In.Net, there are three levels of access to distributed computing machinery: In.Net, there are three.
An program As a simple example of socket programming we can implement a program that sends to a remote site As a simple example of socket.
CSCI 6962: Server-side Design and Programming Web Services.
Jozef Goetz, Application Layer PART VI Jozef Goetz, Position of application layer The application layer enables the user, whether human.
Lecture 15 Introduction to Web Services Web Service Applications.
Java RMI: Remote Method Invocation January 2000 Nancy McCracken Syracuse University.
1 Java RMI G53ACC Chris Greenhalgh. 2 Contents l Java RMI overview l A Java RMI example –Overview –Walk-through l Implementation notes –Argument passing.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
RMI remote method invocation. Traditional network programming The client program sends data to the server in some intermediary format and the server has.
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
 Remote Method Invocation  A true distributed computing application interface for Java, written to provide easy access to objects existing on remote.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Introduction to Spring Remoting Simplifying.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 43 Remote Method Invocation.
Copyright © 2013 Curt Hill SOAP Protocol for exchanging data and Enabling Web Services.
Hwajung Lee.  Interprocess Communication (IPC) is at the heart of distributed computing.  Processes and Threads  Process is the execution of a program.
.Net Remoting The Other RPC Architecture Doug Gregory October 27, 2003.
S imple O bject A ccess P rotocol Karthikeyan Chandrasekaran & Nandakumar Padmanabhan.
S O A P ‘the protocol formerly known as Simple Object Access Protocol’ Team Pluto Bonnie, Brandon, George, Hojun.
Remote Method Invocation by James Hunt, Joel Dominic, and Adam Mcculloch.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Web Services An Introduction Copyright © Curt Hill.
Java Network Programming Network Programming Spring 2000 Jeffrey E. Care
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.
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.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
.NET Remoting. Remoting Introduction The process of programs or components interacting across certain boundaries either different processes or machines.
Distributed Objects. Contents I. The Roles of Client and Server II. Remote Method Calls III. The RMI Programming Model IV. Parameters and Return Values.
Java Distributed Computing
Internet and Distributed Application Services
.NET Remoting Priyanka Bharatula.
WEB SERVICES.
MCA – 405 Elective –I (A) Java Programming & Technology
Presentation 23 .NET Remoting Introduced
What is RMI? Remote Method Invocation
Remote Method Invocation
Knowledge Byte In this section, you will learn about:
The command invocation protocol
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
Chapter 46 Remote Method Invocation
Jim Fawcett CSE791 – Distributed Objects Spring 2002
Presentation transcript:

C# and Windows Programming Application Domains and Remoting

2 Contents Application Domains Remoting

3 Processes A process is a separate program running under the control of the operating system A process  Has its own private memory  Is scheduled to run directly by the operating system  Cannot access memory not allocated to the process

4 Threads Threads are often referred to as lightweight processes Threads exist within a process and can run concurrently They differ from processes in that all threads in a process share the memory of the process

5 Application Domains The application domain provides a new way to split a process into parts Each application domain can run a separate application within the same process An application domain cannot access the resources of another application context One application domain can crash and the others will be unaffected Each application domain has its own threads

6 Application Domains Application Domain 1 Application Domain 2 Application Domain 3 Process 2098 Thread

7 Application Domains When we start an application, we can create new application domains We can then load an assembly into each application domain and run it The default application domain can then stop and start the applications in the other domains Each domain can also have its own security in effect

8 Remote Communication Remote communication must be used to communicate between  two processes on the same machine  Two application domains within the same process  Two processes on different computers

9 Interprocess Communication When two processes are on the same machine, they have options as to how they can communicate  Shared memory Memory outside each process which can be accessed by each process  Pipes Data streams between processes which usually run through buffers owned by the operating system  Internet Using the internet to communicate between processes

10 Remote Procedure Calls Sending bytes between processes is a primitive ability and most applications need more than this This forces applications to define protocols to define meaning for the byte streams This effort can be saved if a useful protocol is defined in advance

11 Remote Procedure Calls The remote procedure call provides a pre- defined protocol that exactly matches the method calls of a programming language RPC  Allows a method on one computer to invoke a method on another computer  Parameters can be transmitted and results returned  The developer is barely aware that the procedure being invoked is not in the local process memory

12 The RPC Landscape RMI  Java Remote Method Invocation  Java only CORBA  Common Object Request Broker  Language independent SOAP  Simple Object Access Protocol  Language independent.NET Remoting .NET native RPC .NET only at the moment

13 Proxies A proxy is something which stands in place of something else In RPC, proxies are used to represent remote objects A proxy must  Implement the same interface as the remote object  Implement each method to package the method call, send it across a network, and return the response  It must do this transparently

14 Proxies Local Class Proxy Remote Interface Sink Remote Object implements Network Method call Method call Serialized Data A proxy has the same interface as the remote object It turns a method call into serialized data and sends the data across the net to the remote object

15 Marshaling by Value Objects cannot just be sent across a network They must be turned into a data stream for transmission The data stream consists of  The class or type of the object  The types of the fields  The data in the fields

16 Marshaling by Value When method parameters are sent across a network, they are usually serialized Serialization turns a primitive or object into a data stream which can be transmitted across a serial connection Deserialization at the receiving end can turn the serialized stream back into an object with the same values as the original

17 Marshaling by Reference Marshaling by value sends a copy of an object across a network There is another way to access an object across a network – marshal by reference Marshall by reference sends a proxy for the object across the net This looks like the real object, but it makes network calls to the real object when you ask it to do anything

18 Transmission Protocols At present, remoting supports two protocols  HTTP The data is serialized into a textual format called the Simple Object Access Protocol and transmitted via the web The advantage is that many companies close all ports except port 80 for security reasons and this might be the only way to transport requests

19 Transmission Protocols  TCP/IP This serializes into a binary stream transported over TCP/IP sockets It requires the use of ports other than 80 Since the stream is binary, it is more compact and efficient than the textual stream used by SOAP

20 Simple Object Access Protocol SOAP is a textual form of RPC It represents all the information for a remote procedure call as an XML document Any objects which have to be passed are also represented as XML documents SOAP is a surprisingly complex format

21 Clients and Servers Remote objects listen for requests from clients in the form of method calls In this way, a remote object acts as a server and the program calling the remote method is the client In many cases, one remote object will call another and they will alternately become clients and servers as the exchange continues

22 Publishing How do you find a remote object? When a remote object is created, it publishes its location in a directory  It selects a name and binds its internet address and proxy to the name The client then asks the server for the remote object and is given a proxy for the object

23 * Daniel Meng

24 Remoting Components Proxies  Have the same interface as a remote object  Marshal the calls and transmit them across a network  Transparent proxy This presents the remote interface and is what is called by the client  Real proxy This is called by the transparent proxy and marshals the data

25 Remoting Components Formatters  Translates an object into its serialized form Sinks  These are components which process the messages  They are in a chain which can be extended  They can Enforce security Act as formatters Encrypt the messages

26 Remoting Components Channels  The channel is the part that is responsible for the transport of the messages  This is either an HTTP channel or a TCP/IP channel Custom Sinks  You can create custom sinks to do additional processing of the messages

27 Remote Object Lifetime When you create a remote object you can select between  Single Call Every call to the object generates a new instance of the object which handles the request and then dies This is suitable if each call should have its own data and should have no memory of any other calls This makes the remote object stateless

28 Remote Object Lifetime  Singleton If you select this, then all calls to the remote object are handled by the same object There is only a single copy of the object Data can be stored in the object and it will be available to the next call to the object This makes the object stateful

29 Example: Remote Phone Directory We will now look at a simple example of a remote phone directory consisting of  PhoneDirectory A remote object acting as a directory  PhoneInfo A serializable class used to return the phone information on a person  Client A command line application which looks up phone information and displays the results

30 Step 1: Interfaces First, create an interface for the remote object public interface IPhoneDirectory { PhoneInfo GetPhoneInfo(string name); }

31 Step 1: Interfaces You might also want to make an interface for the serializable classes public interface IPhoneInfo { string Name { get;} string Address { get;} string Phone { get;} string ToString(); }

32 Step 2: Remote Object This must be accessed by reference Therefore, it must extend MarshalByRefObject class PhoneDirectory : MarshalByRefObject, IPhoneDirectory { Hashtable phoneTable = new Hashtable(); … }

33 Step 2: Remote Object The constructor fills the phone dir public PhoneDirectory() { phoneTable["Fred"] = new PhoneInfo("Fred Flintstone", "99 Granite Way", " "); phoneTable["Wilma"] = new PhoneInfo("Wilma Flintstone", "99 Granite Way", " "); phoneTable["Barney"] = new PhoneInfo("Barney Rubble", "97 Granite Way", " "); phoneTable["Betty"] = new PhoneInfo("Betty Rubble", "97 Granite Way", " "); phoneTable["Bam Bam"] = new PhoneInfo("Bam Bam Flintstone", "99 Granite Way", " "); }

34 Step 2: Remote Object Finally, we have the method to return a phone entry public PhoneInfo GetPhoneInfo(String name) { return (PhoneInfo)phoneTable[name]; }

35 Step 3: Serializable Data Now, we make the PhoneInfo class serializable [Serializable] public class PhoneInfo { String _name; String _address; String _phoneNumber; public PhoneInfo(string nm, string adr, string ph) { _name = nm; _address = adr; _phoneNumber = ph; } … }

36 Step 4: Create a Server This is a Main method to create and publish the remote object static void Main(string[] args) { TcpServerChannel channel = new TcpServerChannel(9999); ChannelServices.RegisterChannel(channel, false); RemotingConfiguration.RegisterWellKnownServiceType( typeof (PhoneDirectory), "PhoneDirectory", WellKnownObjectMode.Singleton); … }

37 Step 4: Create a Server Create channel on port 9999 TcpServerChannel channel = new TcpServerChannel(9999); Register channel without security ChannelServices.RegisterChannel(channel, false); Create the remote object RemotingConfiguration.RegisterWellKnownServiceType (typeof (PhoneDirectory), "PhoneDirectory", WellKnownObjectMode.Singleton);

38 Step 5: Create a Client Create a channel ChannelServices.RegisterChannel(new TcpClientChannel(), false); Locate remote object IPhoneDirectory phoneDir = (IPhoneDirectory)Activator.GetObject( typeof(IPhoneDirectory), "tcp://localhost:9999/PhoneDirectory"); Invoke a method PhoneInfo info = phoneDir.GetPhoneInfo(“Fred”); * see remote_demo, remote_demo_client