I am trying to implement a callback from server to client. But somehow
the code is not getting executed at the client end..


Server Code
===========
using System;
using System.Runtime;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using ServerApp;


namespace ServerApp
{
public class Class2
{

[STAThread]
static void Main(string[] args)
{ 


TcpChannel Channel = new TcpChannel(10000);
ChannelServices.RegisterChannel(Channel);
RemotingConfiguration.RegisterActivatedServiceType(typeof(clsBroadCast))
;
System.Console.WriteLine("Press any key");
System.Console.ReadLine();

}
}
}


BroadCast Code
==============

using System;
using System.Runtime;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

public delegate void CDelegate();

public class clsBroadCast : System.MarshalByRefObject
{
public event CDelegate ClientEvent;

public clsBroadCast()
{
System.Console.WriteLine("Constructor Called");
}


public void CallBack()
{

ClientEvent();
System.Console.WriteLine("Callback Over");
}
}

EmployeeData Code
============
using System;

public class EmployeeData   : System.MarshalByRefObject
{


[OneWay]
public void ClientCallBack()
{
System.Console.WriteLine("Client CallBack Called");

}


}

Client Code
========

using System;
using System.Runtime;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Collections;



namespace ClientApp
{
class ClsClient
{

[STAThread]
static void Main(string[] args)
{

RemotingConfiguration.Configure("ClientApp.exe.config");
EmployeeData cdata = new EmployeeData();
clsBroadCast clientobj  = new clsBroadCast();
clientobj.ClientEvent += new CDelegate(cdata.ClientCallBack);
clientobj.CallBack();
}

}
}

Configuration File
===========
<configuration>
  <system.runtime.remoting>
    <application>
    
      <client url="tcp://coernd1:10000">
<activated type="clsBroadCast, BroadCast"/>
      </client>
      
      <channels>
        <channel ref="tcp" port="10000"/>
      </channels>
      
    </application>
  </system.runtime.remoting>
</configuration>




Regards,
Yogesh S
-----------------------------------------------------------------------
Financial Technologies (India) Ltd.
www: ftindia.com e-mail:  <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED]
+91 22 616 4145 (P) +91 22 612 2342 (F)
------------------------------------------------------------------------
---------------------------------------------
The information in this E-mail (which includes any files transmitted
with it) is CONFIDENTIAL and may be legally PRIVILEGED. It is intended
solely for the addressee and access to this email by anyone else is
unauthorized. If you have received it in error, please destroy any
copies of this message, including any attachments, and delete it from
your system notifying the sender immediately. Any disclosure, copying,
distribution, dissemination, forwarding, printing or any action taken or
omitted to be taken in reliance on it or utilizing the same for any
purpose other than what it is intended for, is prohibited and may be
unlawful.
------------------------------------------------------------------------
---------------------------------------------

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to