c# remoting 问题

zbking 2018-05-25 01:51:20
远程对象类
public class RemoteObject:System.MarshalByRefObject
{
public RemoteObject()
{
}
public void SetLive(int processid)
{
foreach (Client item in clientlist)
{
if (item.pid == processid)
{
item.LiveCount = 0;
}
}
}

public List<Client> clientlist=new List<Client>();
public void Logon(string appname,int processid,string path,int num)
{
if (!ChkApp(processid))
{
Client cl = new Client(appname, processid,path,num);
clientlist.Add(cl);
}

}
}

服务器代码
public partial class F_ser : Form
{
public F_ser()
{
InitializeComponent();
}
TcpServerChannel channel;

RemoteObject tmp;
private void Form1_Load(object sender, EventArgs e)
{
channel = new TcpServerChannel(6666);
ChannelServices.RegisterChannel(channel);

RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemoteObject), "RemoteObject", WellKnownObjectMode.Singleton);


}

private void button1_Click(object sender, EventArgs e)
{
//(typeof(ZJL.RemoteObject.RemoteObject)
MessageBox.Show(tmp.clientlist.Count.ToString());
}

private void F_ser_FormClosing(object sender, FormClosingEventArgs e)
{

}
}
问题是我如何在服务器端访问 RemoteObject.clientlist对象?在线等,谢谢大佬支持下;
...全文
730 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
zbking 2018-05-25
  • 打赏
  • 举报
回复
简单来讲就是怎么在服务器端访问远程对象类

111,097

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧