当前位置: 代码迷 >> Web Service >> remoting和事件解决方案
  详细解决方案

remoting和事件解决方案

热度:331   发布时间:2016-05-02 03:04:59.0
remoting和事件
public   class   RemoteServer   :   MarshalByRefObject  
{
public   delegate   void   MyEventHandler(object   sender,MyEventArgs   e);
public   event   MyEventHandler   MyEvent;  

public   RemoteServer()
{
Console.WriteLine( "RemoteServer   activated ");
}

public   void   SyncCache()
{
OnMyEvent(new   MyEventArgs(0));  
}

protected   void   OnMyEvent(MyEventArgs   e)
{
if   (MyEvent!=null)
{
MyEvent(this,e);
}
}  
}
服务器
//tcp   channel
....
ChannelServices.RegisterChannel(Ch); RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemotingCore.RemoteServer), "WebService.ClearCache ",   WellKnownObjectMode.SingleCall);
问题是:   我想把它的事件和服务器上另一个类A的方法关联,就是说客户端调用remoting   object的方法相当于调用了类A的方法.
但现在看到的sample都是只能在客户端才能处理事件.怎么能在服务器就能处理事件.

------解决方案--------------------
我来我来JFJF
  相关解决方案