Remoting - WordPress.com

advertisement
Remoting
It is a technology of microsoft for developing distributed application replcing traditional
DCOM.All distributed technology need consuming libraries present on remote machines. In
dot net libraries were implemented as Assemblies,where we can consume an assembly
residing on local machine by adding its reference.we can now consume assembly on remote
machine using remoting.
For developing remote application first we need to understand few things
1. Serialization Deserialization
To exchange the information between both parties there is process serialization and
Deserialization. As application represents data in high level(object format) needs to
converted into low level(binary or text) and then transfer to another machine where on
target machine again low level data needs to converted into high level.
To perform serialization & Deserialization remoting provides formatter classes.
For binary conversion: Binary Formatters -TCP server channels -TcpClient Channels.
For Text conversion: Soap Formatters -Http server channels -HttpClient Channels.
Binary formatters are used for binary serialization and deserialization and soap formatters
are used for text serialization and deserialization.
It is to be noted that traditional Dcom supports only binary.
2.Marshalling And Unmarshalling
After serializing data which has to be sent to target machine it packages data into packets.
This is called marshalling at this time it associates the ip address of target machine where
the information has to be sent. Unmarshalling is opposite to marshalling which opens packet
of data for de-serializing.
3 Activation Models
In execution of remoting application client needs object of remote class to invoke methods
under it. Activation model decide where remote class object resides in execution of
application. Remoting supports two different types of activation models
3.1. Server Activated Objects
In SAO model we there are two types like singleton and singlecall
A. SingleTon
In this case whenever a first request comes from client an object of remote class gets
created and its reference is given to client, from every new request come from new client,
server provides reference of same object which is already created, so changes made by one
client reflected to other. It is widely used in development like public chat, cricket score,
share price.
.
B. SingleCall:
In this mode whenever a request comes from client 1 object of remote class gets created
and its reference is given to client, once the request is served immediately object gets
destroyed without allowing him to make any other request on that object, for a new request
new o bject gets created again and destroyed. used in development of single request app
like "RailWAY PNR status enquiry"," ATM Machines"
This is highly secured model used in app development.
3.2: Client Activated Objects
In this case whenever first request from a client an object of remote class is created and
provided using which client can make any no of request. Here a separate object will be
given to client so changes made by one client will not reflect other. used in development of
application that requires multiple request for single client like "Traditional Atm Machines"
where we can perform multiple transactions once we insert card.
4. Server
Whenever we want to develop an application to be consumed from remote machines we
require someone to take request from clients. To take request from client we use server
software's which works on principles request and response. we can install multiple server
software's on machine , but each server should be running on separate logical address
known as port. In process of developing remoting application it is our responsibility to
develop server that takes request of client for remote class, because class is not capable of
taking request.
The server which is to be develop has to be running on unique port of OS. By default every
machine has ports ranging between 0-65535 in which were OS reserved ports, rest can be
used by any app.
After developing Remote server remote class on machine has to be registered under server
with alias name, so that client can request to required class.
5. Remote Interface:
In remoting the methods we want to define under Remote Class, that are accessible to
clients should be first declared under an interface and then implemented in remote class
which is a rule. The same interface will also be provided to clients that acts as proxy to
Remote class on client machine which will be used in 2 ways
1.
2.
Using it clients can be recognize methods of remote class.
Using it we can hold reference of remote class on client machines.
Execution of Remote Application:
1.
2.
3.
4.
5.
6.
Client sends a request a server
Server creates object of remote class
Send reference of that of object to client which has to be captured under interface
variable
After capturing variable gets converted into reference pointing to object of server
Now UI can invoke methods of remote on reference
Methods gets executed on server machine as reference points to object on server.
Download