Remoting Basic
MarshalByRef executes remote method calls on the server side. Only ObjRef-networked object pointer is passed around. Client doesn't have the complied object, but the interface or base class to the object.
ByValue - class need to be serializable. Object is serialized to binary or string(xml) and transport between server/client. It then restored to a copy of the original object at the other end. Which means client and server both need the complied class prototype. State info is preserved.
Basic Architecture
At least three three assemblies are needed for a .net remoting project:
1. Shared Assembly: Client and server both need to have access to the same interface definition (MarshalByRef), serializable objects(ByValue)
2. Server
3. Client
Implement remoting project: Life Cycle
1. Implement SharedAssembly
1.1 Define the remote interface
1.2 Define data class that will be passed around in the shared
2. Implement Server
2.1 Implement the interface by Server.
2.2 Create a new channel and register it to the remoting service.
2.3 Register the server service as "RegisterWellKnownServiceType"
3. Implement client
3.1 Registering client channel
3.2 create local proxt object to forward calls to server
No comments:
Post a Comment