SiteMap  | About    

Remote Listener Application

We already created a Remote Type Object RemoteTime in the previous section. We have to create a listener Object for enable Objects in other application domains to create instances of this object (RemoteTime) Remotely. When creating a listener Object we have to choose and register a channel for handle the networking protocol and serialization formats and register the Type with the .NET Remoting system, so that it can use the channel to listen for requests for the Type. Channels are Objects that responsible of handling the network protocols and serialization formats.

In the following example we are creating a listener application TimeListener . It will act as a listener Object for the Remote Type RemoteTime. The Listener class TimeListener must be able to find the TimeListener.exe.config file to load the configuration for the RemotableType class.

Imports System
Imports System.Runtime.Remoting

Public Class TimeListener
   Public Shared Sub Main()
      Console.WriteLine("Listening for requests from the Client. Press Enter to exit...")
   End Sub 
End Class

Copy and paste the above VB.Net source code into a file and save it as TimeListener.vb.
We have to create additional configuration file to provide the communication information to the listener Object. The configuration file is an XML structured file. We can specify the Activation Mode , the Remote Type , Channel , port for communication etc. through the configuration file .


Click here to download TimeListener.exe.config .

Compile the class file TimeListener.vb using the command-line tools that ship with the .NET Framework SDK.

At the command prompt in the directory in which you saved the file, type the following command:

vbc /r:RemoteTime.dll TimeListener.vb

After you compile the TimeListener.vb , you will get a file called TimeListener.exe in the directory which you saved the source file (C) 2016    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.