Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear friend,

I am doing a remoting application. I have 3 classes (students, teachers, subjects) which will be used as remote object.

I have only 1 host application. Code is the following:

Imports System
Imports System.Runtime.Remoting

Public Class MyHost
    Public Shared Sub Main()
        RemotingConfiguration.Configure("MyHost.exe.config", false)
        Console.WriteLine("Listening for requests. Press enter to exit...")
        Console.ReadLine()
    End Sub
End Class


and the .config file is


<configuration>
   <system.runtime.remoting>
      <application>
         <service>
            <wellknown>
               mode="Singleton"
               type="MyRemoteClass, MyRemoteClass"
               objectUri="MyRemoteObject.rem"
            />
         </wellknown></service>
         <channels>
            <channel ref="tcp" port="8989" />
         </channels>
      </application>
</system.runtime.remoting>
</configuration>



Using the same host, how can i use those 3 remote objects in runtime? or, do i need to individual host for individual object?

Please help me.

Thanking you in anticipation.

Regards
Saumitra.
Posted
Updated 21-Jul-11 3:13am
v2
Comments
[no name] 21-Jul-11 9:14am    
I would suggest you start looking at WCF.
Saumitra Kumar Paul 21-Jul-11 9:44am    
But i think remoting is best for my type of application.

Sorry for not answering your question directly. There is a better way.

The best you can do in this case is to create a single center "managing" remote object which would provide interface to all other objects you're trying to implement as remote objects. Those nested objects also should be implemented inheriting from System.MarshalByRefObject as you probably already do. Each of their types should implement some interface, so the object should be represented by their interfaces. The "managing" object's interface should provide interface references to the nested objects.

—SA
 
Share this answer
 
v2
Thanks SAKryukov. I got a concept from you. However, i have seen an article doing it by the following code in the host config file:

<wellknown mode="single call" type="namespace.class1,assembly1" objecturi="class1.uri">
<wellknown mode="single call" type="namespace.class2,assembly1" objecturi="class2.uri"></wellknown></wellknown>


I am not sure whether it is the only or simplest way. I have not found any other article solving this problem "hosting multiple object with .Net remoting. Would you please provide me any article or example that you suggested?

Thank you very much.

Saumitra Kumar Paul
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900