punjabtechnicaluniversity.blogspot.in
<configuration>
<system.runtime.remoting>
<application name=”Server”>
<service>
<wellknown
mode=”SingleCall”
type=”Server.ClsServer, Server”
objectUri=”RemoteObject” />
</service>
<channels>
<channel ref=”tcp server” port=”9000" />
</channels>
</application>
</system.runtime.remoting>
</configuration>
Later this config file can be loaded using the following code.
RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ApplicationBase
& “Server.config”)
Same way we also have client.config file for loading the client remoting parameters.
<configuration>
<system.runtime.remoting>
<application name=”Client”>
<client url=”tcp://localhost:9000/RemoteObject”>
<wellknown
type=”CommonInterface.Icommon, Icommon”
url = “tcp://localhost:9000/Server/RemoteObject”/>
</client>
<channels>
<channel ref=”tcp client” />
</channels>
</application>
</system.runtime.remoting>
</configuration>
client remoting can then load the configuration file by using :-
Dim IobjCommon As CommonInterFace.Icommon
Dim StrData As String
Dim objServiceEntries As WellKnownClientTypeEntry()
RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ApplicationBase
& “Client.config”)
objServiceEntries =
RemotingConfiguration.GetRegisteredWellKnownClientTypes()
IobjCommon = Activator.GetObject(GetType(Icommon),
objServiceEntries(0).ObjectUrl.ToString())
StrData = IobjCommon.GetValue()
Console.WriteLine(“ Serve side Data is “ & StrData)
Console.ReadLine()
Both remoting server and remoting client parameters can be provided through config files.Below is a sample of server config file which provides all remoting parameter values which we where providing through code.
<system.runtime.remoting>
<application name=”Server”>
<service>
<wellknown
mode=”SingleCall”
type=”Server.ClsServer, Server”
objectUri=”RemoteObject” />
</service>
<channels>
<channel ref=”tcp server” port=”9000" />
</channels>
</application>
</system.runtime.remoting>
</configuration>
Later this config file can be loaded using the following code.
RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ApplicationBase
& “Server.config”)
Same way we also have client.config file for loading the client remoting parameters.
<configuration>
<system.runtime.remoting>
<application name=”Client”>
<client url=”tcp://localhost:9000/RemoteObject”>
<wellknown
type=”CommonInterface.Icommon, Icommon”
url = “tcp://localhost:9000/Server/RemoteObject”/>
</client>
<channels>
<channel ref=”tcp client” />
</channels>
</application>
</system.runtime.remoting>
</configuration>
client remoting can then load the configuration file by using :-
Dim IobjCommon As CommonInterFace.Icommon
Dim StrData As String
Dim objServiceEntries As WellKnownClientTypeEntry()
RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ApplicationBase
& “Client.config”)
objServiceEntries =
RemotingConfiguration.GetRegisteredWellKnownClientTypes()
IobjCommon = Activator.GetObject(GetType(Icommon),
objServiceEntries(0).ObjectUrl.ToString())
StrData = IobjCommon.GetValue()
Console.WriteLine(“ Serve side Data is “ & StrData)
Console.ReadLine()
Note :- Complete source is provided in CD in folder “RemotingObjectLifeTime”.If you run Server and Client following output can be seen.All source is compiled using VS2005 BETA1
Output of Server and Client for RemotingObjectLifeTime project
0 comments:
Post a Comment
North India Campus