.Net Remoting
Distributed Application                                                         RemoteDistributed systems are             ...
Distributed Application Remote                                                   Remote Objects                           ...
Communication Channel                     Communication                        ChannelApplication  Domain(Assembly)       ...
Remoting OverviewApplication  Domain(Assembly)  Local  Object                                                  Remote     ...
Remote object lifetimeApplication  Domain(Assembly)   Local  Service                                              Remote  ...
Local Objects                           Application                             Domain                           (Assembly...
Remote Object SystemApplication  Domain(Assembly)  Local  Object                                        Remote Serialize  ...
Remote Object Activation                                  Client activated objects                                  These ...
Client application domain         Marshaling           Server application domain                 Local      Objects passed...
Client application domain         Marshaling           Server application domain                  Remote Object           ...
Client application domain            Marshaling       Server application domain                                           ...
Client application domain        Marshaling         Server application domain                                             ...
Channels• TCP Channel – Faster and more secure  communication. Intended predominantly  for intra-domain communication.  Re...
Client application domain    TCP Channel                            Using System.Runtime.Remoting.Channel.Http            ...
Client application domain       Activation          Server application domain                                             ...
Client application domain   Activation                            Server Activation is typically used when objects        ...
Client application domain     Activation                                                           SAO – Single call      ...
Registering Remote Object• Client must have some understanding of  the interface of the remote object.• So the compiler ha...
ActivationRegistering remote    Object mode : this defines the server           object               activation, such as S...
Activation         Object mode : this defines the server activation,Client application domain   such as SingleCall or Sing...
ActivationClient application domain                RemotingConfiguration.Configure(“myconfig.config”);        Client objec...
Client sideThe remote object will not instantiate itself, theclient is required to initialize it, or call a method.This is...
Determining data typeClient requires type information about the classwhen this client code is compiled.  1- With a referen...
Upcoming SlideShare
Loading in...5
×

Net remoting

340

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
340
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Net remoting

  1. 1. .Net Remoting
  2. 2. Distributed Application RemoteDistributed systems are Service Remotegenerally more scalable , more Servicerobust and increase availabilityof services Client Requests remote process Common distributed protocols are: RPC : Remote Procedure Calls Server runs the DCOM : MS Distributed Service/process and Object Model returns the result CORBA : Common Object Request Broker Architecture Client RMI : Java Remote Invocation Not Secure for Remote external networks Service
  3. 3. Distributed Application Remote Remote Objects Objects Communication.Net Remoting allows Channelaccess to objects Applicationplaced around a Domainnetwork.It has: (Assembly)•Communication channel•A formatter : This can be LocalBinary encoded or XML Objectsencoded (SOAP) Remote Objects
  4. 4. Communication Channel Communication ChannelApplication Domain(Assembly) Formatter: Binary Remote Fast but not as Objects compatible as XML Local Objects Remote Objects Formatter: XML (SOAP) Highly compatible but not as fast
  5. 5. Remoting OverviewApplication Domain(Assembly) Local Object Remote Object Different Assemblies are used between Local and remote Service Typically dll
  6. 6. Remote object lifetimeApplication Domain(Assembly) Local Service Remote Service Does the object persists?
  7. 7. Local Objects Application Domain (Assembly) Application Public void myObject (myObjectClass obj)Pass By Value { } Local Object Pass By Reference Public void myObject (ref myObjectClass obj) Local { Object } Within Local Assembly
  8. 8. Remote Object SystemApplication Domain(Assembly) Local Object Remote Serialize Desterilize ObjectEncapsulate Formatter Decapsulate (SOAP) (Encoder) (SOAP)Communicate Communicate
  9. 9. Remote Object Activation Client activated objects These have a finite lease time , Once their lease time expires they are left for garbage collector. Each caller would get their copy of the object Application Remote ObjectServer Activated Object Namespace used for remoting: System.Net :This include classesSingleton :All clients get the same related to the networking elementsinstance of the server object. It can of the distributed systemcommunicate with multiple clients . Life System.Runtime.Remoting : Thistime is determined by lease based includes classes for the remotelifetime (Used for chats, community aspects of the .NET framework , suchnetworks) as mechanism for remoteSingle Call :Is a type of object activation communication between objectswhen object is discarded immediately System.Web.Services :This includesafter use. It is stateless. protocols relating to Web services such as those to HTTP and SOAP encapsulation
  10. 10. Client application domain Marshaling Server application domain Local Objects passed by reference or value for local objects . Remote Object Object For remote it is not possible to pass by reference – Remote objects must be Client object marshaled Server Object Proxy Remoting System Communication Remoting System Channel Serialization
  11. 11. Client application domain Marshaling Server application domain Remote Object Local public class ShowCapital : MarshalByRefObject Remote { Object Object public ShowCapital() { } Client object public string show ( string country) {aCountry capital } } Creates dll Proxy on server ShowCapital() aCountry capital Remoting System Communication Remoting System Channel Serialization
  12. 12. Client application domain Marshaling Server application domain Remote Local Object Object Object.dll Access public methods of remotable obj Client objectaCountr capitaly Proxy ShowCapital() aountry capital Remoting System Communication Remoting System Channel Serialisation
  13. 13. Client application domain Marshaling Server application domain Remote Local Object Object Object.dll Client object We need object invocation. And channel configuration. Eg. TCP channel 1234 , firewalls should allow Proxy channel ShowCapital() Remoting System Communication Remoting System Channel Serialisation
  14. 14. Channels• TCP Channel – Faster and more secure communication. Intended predominantly for intra-domain communication. Requires port activation for communication with external world• HTTP Channel performed using HTTP/SOAP protocol. Good for external communication since it is implemented over HTTP/HTTPS and most firewalls allow HTTP calls through.
  15. 15. Client application domain TCP Channel Using System.Runtime.Remoting.Channel.Http Using System.Runtime.Remoting.Channel.Tcp Local Object TcpChannel channel = new TcpChannel(1234) ChannelServices.RegisterChannel(channel) Client object Makes sure channel is not used by other apps Proxy Channel=1234 Remoting System Communication Channel Server activation object
  16. 16. Client application domain Activation Server application domain Remote Object Object.dll Channels map onto TCP ports.. Client object Standard ports are: 21-FTP 23-TELNET 56-DNS Proxy 80-www ShowCapital() 110-POP 3 >1024 : developer use Remoting System Communication Remoting System Channel Serialisation
  17. 17. Client application domain Activation Server Activation is typically used when objects do not required to maintain their state between method calls(Single Call ) or where there are multiple clients who call methods on the same object instance where the object maintains its Client object state between function calls (singleton) Proxy In a client activated object the client initiates the object and manages it for its lifetime. Remoting System
  18. 18. Client application domain Activation SAO – Single call What’s the capital of Canada Ottawa Client object Login Name: John SAO – Singleton OK Send email to Bert Proxy Ok CAO- Client Remoting System Get data Manages Lifetime Get data Delete
  19. 19. Registering Remote Object• Client must have some understanding of the interface of the remote object.• So the compiler has check accesses to remote object
  20. 20. ActivationRegistering remote Object mode : this defines the server object activation, such as SingleCall or Singleton Client application domain WellKnownObjectMode.SingleCall Object URI: This is the indicator that the clients use to locate the object newClass.ShowCapital Assembly name: This defines the assembly in which the class is contained in. Client object “ShowCapital1” Type name : This defines the data type of the remote object. Typeof(newclass.ShowCapital) Proxy Remote Object Class Method Remoting System newClass.ShowCapitl Assembly ShowCapital1
  21. 21. Activation Object mode : this defines the server activation,Client application domain such as SingleCall or Singleton WellKnownObjectMode.SingleCall Object URI: This is the indicator that the clients use to locate the object newClass.ShowCapital Assembly name: This defines the assembly in which the class is contained in. Client object “ShowCapital1” Type name : This defines that data type of the remote object. Typeof(newclass.ShowCapital) Proxy Remote Remote objects are registered using the RegisterWellKnownServiceType Object Parameters are (data type , assembly name , activation method) .eg: RemotingConfiguration.RegisterWellKnownServiceType Remoting System (typeof(newClass.ShowCapital),”ShowCapital1”, newClass.ShowCapital WellKnownObjectMode.SingleTon Assembly : ShowCapital1
  22. 22. ActivationClient application domain RemotingConfiguration.Configure(“myconfig.config”); Client object Proxy Remote Object Remoting System
  23. 23. Client sideThe remote object will not instantiate itself, theclient is required to initialize it, or call a method.This is achieved by a client which knows the URIof the remote object and by registering thechannel it prefers using GetObject :TcpClientChannel channel = new TcpClientChannel();ChannelServices.RegisterChannel(channel);ShowCapital sh=(ShowCapital)Activator.GetObject (typeof(newClass.ShowCapital), ”tcp://localhost:1234/ShowCapital”);
  24. 24. Determining data typeClient requires type information about the classwhen this client code is compiled. 1- With a reference to the assembly where the class is stored (use local dll). 2- Using SOAPSUDS tool to extract metadata directly from the endpoint. SOAPSUDS connects to the endpoint and extracts the metadata, and generates an assembly or source code that is then used in the client compilation. 3-By splitting the remote object into an implementation and interface class and then use the interface as a reference when compiling the client
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×