----------------------------------------------------------- New Message on BDOTNET
----------------------------------------------------------- From: Sitaraman Message 13 in Discussion Hi All, Guess it is tiem to get back o basics and clean up the stuf Remoting - it is basically a feature in .Net which a client application on a Machine X allows you transparently execute a functionality(mehod) of a Server application on Machine Y( applies to cross-appdomain calls also). Can be done with the help of MarshalByValueObject or MarshalByRefObject . ill concentrate on the MarshalByRefObejct based remoting as this is where we deal with proxies etc... One thing that is always there is that the called server object WILL ALWAYS be present and activated(instantiated in memory) on the server machine only. The client will have proxy only( or should i say proxies as there is a transparent proxy and Real Proxy). Now question arises on the lifetime of the obejct. how long is the object going to live For this we have two options Activation Server-Actication(Server Activated Objects ar Also called Well-known objects) - This is basically the option when you want the Server to control the lifetime of the object. This again can be of two types and can be controlled thru the well-known mode attribute Singleton - In this case there will be only one instance of the object in memory for any number of clients/client requests. So it is a case of One Server Object Instance irrelevant of the number of clients/requests. Can be used if you want to maintain server application level and client irrelevant State SingleCall - In this case one Server Object instance will be made for every cleint request(method call from client). Can be used when the Server object needs to maintain no State at all Client Activation - This is the case when the client manages the lifetime of the object. In this case there will be One Server Object instance per client. Can be used when you need to maintain Client relevant Server Object Instance State information. Server Activated objects or well-known objects can be created using the Activator.GetObject method and Client Activated objects can be created using the Activator.CreateInstance method Ill come back to using the "New" operator later The following is the sequence that happens when u create a Server Activated Object Client creates an instance of the Server Object Proxies are created(Transparent Proxy and RealProxy). note that at this time there is no call to server to save a network round-trip Client makes a method call The transparent proxy intercepts this method call and checks for the type information and then bundles the call parameters into a message The Realproxy forwards the call by writing it on the wire Call gets remotely executed The following is the sequence that happens when u create a Server Activated Object Client creates an instance of the object Remoting infrastructure creates an message and contacts the Server An instance is made in the server at this time itself(different in server-activaterd objects) Server then returns a objref object back to the client(objref contains the metadata, uuid of the object and info as to how to reach the server). the objref is received by the realproxy in this case and based on it the transparent proxy is created. Transparent proxy is referred by the client here onwards and any call from client will be intercepted by this guy So there is no question of the server object being present or being executed on the client machine as far as the remoting architecture of .Net goes. So Client application is present and runs on client machine Server object is present and running on Server machine The connectivity between the two is provided by the proxies proxies can be real(handles writing the message to the wire) and transparent proxies(handles the cal interception the moment a mehod call is fired by the client app). They are created in a transpaent manner by the remoting infrastructure. the options of loadfrom etc are basically irrelevant in this regard. This is coz loadfrom can be used when u know the location of the server assembly which is present in a local network encironment. What Remoting provied is total transparent architecture, where you can use the TCPChannel and binary formatting if you want a transparent FAST connectivity to a Server obejct in a firewall-free environment(not quite the case in today's dev environment). Where you need to develop applications which need to go across firewall, then u need to use the HTTPChannel with SOAP or binary formatting. In this case also you would use SOAP if you want true cross-OS, cross-Framework interoperabiklity as the SOAP Formatting based remoting will pass the data in the industry standard SOAP format. You can use binary for speed and optimisation if the OS and framework of the Server and client is homogenous/same So use TCP Channel binary formatting - if the server and client are on the same network without firewall restrictions and both of them are of the Same OS and Framework TCP Channel SOAP formatting - if the server and client are on the same network without firewall restrictions and both of them are of the different OS and Framework HTTP Channel binary formatting - if the server and client are on different networks(internet environment probably) with firewall restrictions and both of them are of the Same OS and Framework TCP Channel SOAP formatting - if the server and client are on different networks(internet environment probably) with firewall restrictions and both of them are of the different OS and Framework There are more interesting stuff online in MSDN. The whole Topic and subtopics in the http://msdn.microsoft.com/library/en-us/cpguide/html/cpconnetremotingoverview.asp?frame=true is extremely interesting. took a couple of days to go thru and understand. But makes things very clear. Also it has some interesting examples to try ou. Check it out regards, sr ----------------------------------------------------------- To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings. http://groups.msn.com/BDotNet/_emailsettings.msnw Need help? If you've forgotten your password, please go to Passport Member Services. http://groups.msn.com/_passportredir.msnw?ppmprop=help For other questions or feedback, go to our Contact Us page. http://groups.msn.com/contact If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list. mailto:[EMAIL PROTECTED]
