c# remoting 问题
远程对象类
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对象?在线等,谢谢大佬支持下;