21
Session 7 .NET Remoting II

Session 7

Embed Size (px)

Citation preview

Page 1: Session 7

Session 7

.NET Remoting II

Page 2: Session 7

.NET Remoting II/ 2 of 21

Session Objectives Discuss the three types of Remoting

classes Explain passing objects to remote

methods Explain asynchronous calls to a

remote method Discuss Lifetime management

in .NET Remoting

Page 3: Session 7

.NET Remoting II/ 3 of 21

Passing objects to Remote methods (1)

In .NET remoting, the classes of the objects that can be passed as parameters to remote methods arecategorized as –

Marshal by reference Marshal by value Non-Remotable

Page 4: Session 7

.NET Remoting II/ 4 of 21

Passing objects to Remote methods (2) Example 1 -

Contd…

Page 5: Session 7

.NET Remoting II/ 5 of 21

Passing objects to Remote methods (3)

Contd…

Page 6: Session 7

.NET Remoting II/ 6 of 21

Inheriting from class System.MarshalByRefObject Example 2 -

Contd…

Page 7: Session 7

.NET Remoting II/ 7 of 21

Inheriting from class System.MarshalByRefObject

Contd…

Page 8: Session 7

.NET Remoting II/ 8 of 21

Methods that return objects Example 3 -

Page 9: Session 7

.NET Remoting II/ 9 of 21

Remoting Server Example 4 -

Page 10: Session 7

.NET Remoting II/ 10 of 21

Building a client Example 5 -

Page 11: Session 7

.NET Remoting II/ 11 of 21

Output After executing example 4

followed by example 5

Page 12: Session 7

.NET Remoting II/ 12 of 21

Executing the client Client console in example 5 will

resemble -

Page 13: Session 7

.NET Remoting II/ 13 of 21

Asynchronous Remoting

Client makes a call to a method and then continues to perform other tasks

When the server is available it processes the method and returns the result to the client at a later time

Page 14: Session 7

.NET Remoting II/ 14 of 21

Asynchronous Remoting Example 6 -

Page 15: Session 7

.NET Remoting II/ 15 of 21

Lifetime Management -1 Lifetime management holds good

for clients that are activated as Singleton objects

Properties configured for Lifetime management -

Page 16: Session 7

.NET Remoting II/ 16 of 21

Lifetime Management -2 Example 7 -

Contd…

Page 17: Session 7

.NET Remoting II/ 17 of 21

Contd…

Lifetime Management -3

Page 18: Session 7

.NET Remoting II/ 18 of 21

Lifetime Management -4 Modification -

Page 19: Session 7

.NET Remoting II/ 19 of 21

Example 5 - Modified Example 8 -

Contd…

Page 20: Session 7

.NET Remoting II/ 20 of 21

Example 5 - ModifiedContd…

Page 21: Session 7

.NET Remoting II/ 21 of 21

Example 8 - Output