+ All Categories
Home > Documents > Remo Ting

Remo Ting

Date post: 16-Dec-2015
Category:
Upload: shivuhc
View: 213 times
Download: 0 times
Share this document with a friend
Description:
C
Popular Tags:
32
REMOTING
Transcript
  • REMOTING

  • Remote Action ConceptsAppDomain BAppDomain AObject aObject bRemote Action

  • IntroductionAppDomainAn isolated environment for executing codeLocal ObjectsObjects within the different AppDomainsRemote ObjectsObjects in a different AppDomainRemotingCommunication between objects

    Obj1Obj 2Obj3Obj 4RemotingAppDomain AAppDomain B

  • .NET Remoting Concepts The Two types of marshal objects are as followsBy reference:Inherits from Marshal By RefObject classBy Value:Declares the system to serialize the object automaticaly.Attributes methods for class and field.Example

    /Serializable methodsExampleGetObjectData()Deserialized()

  • Remote Activation ConceptsProcessesIsolates the application from other applications010203040506Process 1Process 2

  • Remote Activation Concepts(Contd)Marchal by reference objectOaOb ProxyObClientServer

  • RemoteActivationConcepts(Contd)Marchal by value object

    OaObObClientServer

  • Types of .NET Remote ObjectsThe two types of activation for marchal by reference objects are as followsServer ActivationObjects are Created by the Server.The two types of server-activated objects are as follows.SingletonSinglecallClient ActivationObjects are created when the new method is invoked.The two types of Client-activated objects are as followsMarshal by referenceMarshal by value

  • ActivationServerClientSingletonSinglecallMarshal by ReferenceMarshal by Value

  • Types of .NET Remote Objects(Contd)Server-activated singletonThe objects have only one instance for all clientsCaCb ProxyCbCaCb ProxyClient AClient BServer

  • Types of .NET Remote Objects(Contd)Server-activated single callNew instances of object are created for every userCaCb ProxyCaCb ProxyClient AClient BServer

  • Types of .NET Remote Objects(Contd)Client-activated Marshal by reference objectsEach client gets its own remote objectCaCb ProxyCaCb ProxyClient AClient BServerCbCb

  • Types of .NET Remote Objects(Contd)Client-activated Marshal by value objectsClients get their own copy of the objectsCaCbCaClient AClient BServerCbCb

  • Hosting Remote Objects ServerServerClient(Remote object)

  • Remoting Architecture in .NETClient-Side ObjectServer-side ObjectClientServerProxyFormattingFormattingTCP/HTTPChannel

  • Hosting .NET Remote ObjectMicrosoft Internet Information Services(IIS) is a run-time environment to host the remote objects.The steps involved in hosting a remote object are as follows.Client object registers a channel.Creates a proxy object.Calls the remote method.Client-side formatter formats the message and transmits it to the Server-side.Server-side formatter reformats the message.The specified function on the remote object is executed and the results are obtained.The same process of formatting and reformatting is reversed and the result is obtained.Client-side ObjectFormatter or ReformatterSever-side Object

  • Server Config File

  • Server Configuration in CodeChannelServices.RegisterChannel(New TcpChannel(8085))

    ChannelServices.RegisterChannel(New HttpChannel(8086))

    RemotingConfiguration.RegisterWellKnownServiceType(GetType(SingletonByRef),SingletonByRefHost.rem,Singleton)

    RemotingConfiguration.RegisterWellKnownServiceType(GetType(SinglecallByRef),SingletonByRefHost.rem,Singlecall)

    RemotingConfiguration.RegisterActivatedServiceType(GetType(ClientActivatedByRef))

  • Server ConfigurationRemotingServices.Marshal(New SingletonByRef(),SingletonByRefHost.rem)TCP:8085HTTP:8086Singleton BYRefInternal Remoting Configuration TablesRemoting Server

  • Client Config File

  • Client Configuration in CodeChannelServices.RegisterChannel(New TcpChannel(8085))

    ChannelServices.RegisterChannel(New HttpChannel(8086))

    RemotingConfiguration.RegisterWellKnownServiceType(GetType(SingletonByRef),tcp://localhost:8085/RemoteHost/SingletoneByRefHost.rem)

    RemotingConfiguration.RegisterWellKnownServiceType(GetType(SinglecallByRef),http://localhost:8086/RemoteHost/SingleCallByRefHost.rem)

    RemotingConfiguration.RegisterActivatedClientType(GetType(ClientActivatedByRef), tcp://localhost:8085/RemoteHost)

  • Client ConfigurationInternal Remoting Configuration TablesTCPHTTPRemoting Client

  • Creating Remote ObjectsSingleton and singlecall functionsNow()(default constructor only)Activator.CreateInstance()Activator.GetObject()remotingServices.Connect()Client AClient BProxyServer

  • Creating Remote Objects(Contd)Client-activated marshal by reference functionsNow()(default constructor only)Now()(Non-default constructor only)Activator.CreateInstance()Return value from functionReturned in ByRef argumentClient-activated marshal by valueIt cannot be created directly.

    ServerClient AClient BObject bObject b

  • Remote Object LifetimeThe AppDomain class contains a lease manager that examines the leases for time expiration.The features of leases for remote objects are as follows:Applies only to the singleton and marshal by reference client-activated objects.Initializes when the object is created.Avoids the changes that are done after intialization.Marks the expired objects for garbage collection.

    ExampleleaseObj=remotingServices.GetLifetimeservice(obj)

  • Remote Object lifetime(contd)ILease interfacesThey are used to define a lifetime lease object.InitialLeaseTime -default:5minutesRenewOncallTime - default:2minutesSponsorshipTimeout - default:2minutesCurrentState

    InitialActiveExpiredRenewingInterfaceLifetime-ObjectLifetime-ILease

  • Remote Object Lifetime(Contd.)

  • Remote Object Lifetime(Contd.)Override initializeLifetimeService methodThe features of overriding initializeLifetimeService method are as follows:Inherited from MarshalByRefObject.Used to initialize lease on specific object.

    Extending the leaseThe methods to extend the lease are as follows:RenewOncallTime should be nonzeroCall.Renew(Time) methodRegister a sponsor on the lease

  • THANK YOU


Recommended