remoting和事件

cenlmmx cenlmmx 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
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都是只能在客户端才能处理事件.怎么能在服务器就能处理事件.
...全文
评论 6
收藏 已收藏
分享
返回顶部
cenlmmx
Web Services 12,164 成员 16,322 内容