Title: 'NET Remoting
1.NET Remoting
- iVS Kolloquium
- Andreas Ulbrich
2Topics
- What is Remoting?
- How is it used?
- How does it work?
- Is it of any use at all?
3Microsoft .NET
- Runtime environment (CLR)
- Execution model, Common Type System (CTS),
Intermediate Language (IL), assembly format, - Class libraries (BCL)
- Compilers (C, C, VB.NET)
- Cunning strategy and a lot of hype
- Besides commercial version shared source version
.NET - Windows and FreeBSD port provided by MSR
- Linux port
4Basic Concepts of .NET Applications
- Applications
- Application Domains
- Object Contexts
- Context-bound objects
- Context-agile objects
- Marshalling
- By value
- By reference
Application
Application Domain
stack call
proxy
marshall by reference
marshall by value
Application Domain
Context
Context
marshalling
copy
bound
agile
5What is Remoting?
- Marshalling across application/machine boundaries
- Distributed object infrastructure (middleware)
- Comparable to CORBA, RMI, DCOM,
- Objects that can be remoted must either be
- Derived from System.Runtime.Remoting.MarshalByRefO
bject - Marked with the Serializable attribute
6Example
7Object Activation
- Who creates server-side remoting objects?
- Server activated objects (SAO)
- Singleton (shared instance)
- Single Call (one instance per invocation)
- Published (like Singleton but created manually)
- Client activated objects (CAO)
8Example
9Other features
- Asysnchronous invocations
- Same as for local invocations
- Oneway (fire and forget) invocations
- Methods decorated with the OneWay attribute
- Events
- Not as intuitive as in the local case
10Object Lifetime
- How to garbage-collect distributed objects?
- (D)COM reference counting ( pinging)
- CORBA nothing at all
- .NET Remoting Leasing
- Leases (time to live) associated with each
remoted object - Increases with every invocation
- Lease sponsors
- Can be configured or even switched off
11Wheres the IDL?
- No IDL? No stubs? No skeletons?
- We actually dont need an IDL
- Use of reflection to extract metadata
- Build stubs (transparent proxy) from metadata at
runtime - Generic skeletons (again using reflection)
- But may need interface definition
- Dont want to ship implementation with client
- Client does not run on .NET (Dont tell
Microsoft!) - Tools for extracting metadata (soapsuds)
- WSDL or metadata assembly
12So, how does it work?
- Just as you might expect
- Turn invocation into message
- Put message on the wire
- Unpack message
- Locate object
- Invoke method
- Put result in a message
- Wire the message
- Unpack the message
- Return result to caller
- But whats so special about this?
13Take Control
- Have access to almost everything along the
message path - Remoting is a framework of pluggable components
- Can customize the behaviour of the system
- Messages
- Channels
- Any object through any channel
- Identified by host and port
- Message Sinks
14The full picture
TransparentProxy
Stack Builder Sink
Lease Sink
RealProxy
Dynamic Sinks
Context Terminator Sink
Cross Context Sink
Dispatch Sink
Dynamic Sinks
Channel Sinks
Message Sinks
Formatter
Formatter
Channel Sinks
SDL Sink
Channel Sinks
Sockets, Operating System, Internet,
Transfer Channel
Transfer Channel
Socket Handler
Server
Client
15Walk through
TransparentProxy
Stack Builder Sink
Lease Sink
RealProxy
Dynamic Sinks
Context Terminator Sink
Cross Context Sink
Dispatch Sink
Dynamic Sinks
Channel Sinks
Message Sinks
Formatter
Formatter
Channel Sinks
SDL Sink
Channel Sinks
Sockets, Operating System, Internet,
Transfer Channel
Transfer Channel
Socket Handler
Server
Client
16Walk through
TransparentProxy
Stack Builder Sink
Lease Sink
RealProxy
Dynamic Sinks
Context Terminator Sink
Cross Context Sink
Dispatch Sink
Dynamic Sinks
Channel Sinks
Message Sinks
Formatter
Formatter
Channel Sinks
SDL Sink
Channel Sinks
Sockets, Operating System, Internet,
Transfer Channel
Transfer Channel
Socket Handler
Server
Client
17Walk through
TransparentProxy
Stack Builder Sink
Lease Sink
RealProxy
Dynamic Sinks
Context Terminator Sink
Cross Context Sink
Dispatch Sink
Dynamic Sinks
Channel Sinks
Message Sinks
Formatter
Formatter
Channel Sinks
SDL Sink
Channel Sinks
Sockets, Operating System, Internet,
Transfer Channel
Transfer Channel
Socket Handler
Server
Client
18Walk through
TransparentProxy
Stack Builder Sink
Lease Sink
RealProxy
Dynamic Sinks
Context Terminator Sink
Cross Context Sink
Dispatch Sink
Dynamic Sinks
Channel Sinks
Message Sinks
Formatter
Formatter
Channel Sinks
SDL Sink
Channel Sinks
Sockets, Operating System, Internet,
Transfer Channel
Transfer Channel
Socket Handler
Server
Client
19Walk through
TransparentProxy
Stack Builder Sink
Lease Sink
RealProxy
Dynamic Sinks
Context Terminator Sink
Cross Context Sink
Dispatch Sink
Dynamic Sinks
Channel Sinks
Message Sinks
Formatter
Formatter
Channel Sinks
SDL Sink
Channel Sinks
Sockets, Operating System, Internet,
Transfer Channel
Transfer Channel
Socket Handler
Server
Client
20Walk through
TransparentProxy
Stack Builder Sink
Lease Sink
RealProxy
Dynamic Sinks
Context Terminator Sink
Cross Context Sink
Dispatch Sink
Dynamic Sinks
Channel Sinks
Message Sinks
Formatter
Formatter
Channel Sinks
SDL Sink
Channel Sinks
Sockets, Operating System, Internet,
Transfer Channel
Transfer Channel
Socket Handler
Server
Client
21Walk through
TransparentProxy
Stack Builder Sink
Lease Sink
RealProxy
Dynamic Sinks
Context Terminator Sink
Cross Context Sink
Dispatch Sink
Dynamic Sinks
Channel Sinks
Message Sinks
Formatter
Formatter
Channel Sinks
SDL Sink
Channel Sinks
Sockets, Operating System, Internet,
Transfer Channel
Transfer Channel
Socket Handler
Server
Client
22Walk through
TransparentProxy
Stack Builder Sink
Lease Sink
RealProxy
Dynamic Sinks
Context Terminator Sink
Cross Context Sink
Dispatch Sink
Dynamic Sinks
Channel Sinks
Message Sinks
Formatter
Formatter
Channel Sinks
SDL Sink
Channel Sinks
Sockets, Operating System, Internet,
Transfer Channel
Transfer Channel
Socket Handler
Server
Client
23Walk through
TransparentProxy
Stack Builder Sink
Lease Sink
RealProxy
Dynamic Sinks
Context Terminator Sink
Cross Context Sink
Dispatch Sink
Dynamic Sinks
Channel Sinks
Message Sinks
Formatter
Formatter
Channel Sinks
SDL Sink
Channel Sinks
Sockets, Operating System, Internet,
Transfer Channel
Transfer Channel
Socket Handler
Server
Client
24Walk through
TransparentProxy
Stack Builder Sink
Lease Sink
RealProxy
Dynamic Sinks
Context Terminator Sink
Cross Context Sink
Dispatch Sink
Dynamic Sinks
Channel Sinks
Message Sinks
Formatter
Formatter
Channel Sinks
SDL Sink
Channel Sinks
Sockets, Operating System, Internet,
Transfer Channel
Transfer Channel
Socket Handler
Server
Client
25Walk through
TransparentProxy
Stack Builder Sink
Lease Sink
RealProxy
Dynamic Sinks
Context Terminator Sink
Cross Context Sink
Dispatch Sink
Dynamic Sinks
Channel Sinks
Message Sinks
Formatter
Formatter
Channel Sinks
SDL Sink
Channel Sinks
Sockets, Operating System, Internet,
Transfer Channel
Transfer Channel
Socket Handler
Server
Client
26Walk through
TransparentProxy
Stack Builder Sink
Lease Sink
RealProxy
Dynamic Sinks
Context Terminator Sink
Cross Context Sink
Dispatch Sink
Dynamic Sinks
Channel Sinks
Message Sinks
Formatter
Formatter
Channel Sinks
SDL Sink
Channel Sinks
Sockets, Operating System, Internet,
Transfer Channel
Transfer Channel
Socket Handler
Server
Client
27Messages
- Represented by objects implementing IMessage
- Dictionary (key, value) holds message content
- __Uri
- __MethodName
- __MethodSignature
- __TypeName
- __Args
- __CallContext
- More spezialized interfaces for easier handling
- IMethodMessage, IMethodCallMessage,
IConstructionCallMessage
28Yet another silly example
- Server side channel sink
- Rewrite target URI to transparently invoke
different object - ...
29Is it of any use?
- Certainly!
- Excellent basis for implementing QoS mechanisms
- Costumizable middleware
- Reflection
- Metadata features of C
- Currently working on
- Contract passing, examination, ressource
allocation - Pluggable IIOP connector (DA Thomas Schneider)
- Planned multicast channel for talking to
multiple objects, channels with bandwidth
reservation, ...
30What I dont like
- VS doesnt run with less than 256 Megs
- Doesnt enforce separation of interfaces and
implementation - Dispatch Sink cant be exchanged or customized
- One connection per invocation on default channels
- Unidirectional channels
- Somewhat confusing docs
- Lot of internal stuff that should be accessible
31Summary
- Nothing really new
- But definitely cool stuff
- Fun to work with
- Use it!!!
- Part of the .NET compact framework running on CE
(Pocket PC) and Palm (No excuse here -)
32References
- Advanced .NET Remoting, Ingo RammerApress,
Berkely, 2002 - Programming C, Jesse LibertyOReilly,
Sebastopol, 2nd ed., 2002 - Rotor source codeMicrosoft, 2002
- .NET SDK Documentation
33(No Transcript)
34Logo
Auszeichnung
35Logofarbe
100
80
70
60
50
40
30
20
Sekundärfarben (Blautöne)
Sekundärfarben (Brauntöne)
Farben für Grafiken (Grautöne)
70
50
30
10
Auszeichnungsfarben für Grafiken
Auszeichnungsfarben für TextPantone
151CPantone Process Cyan C