服务器
BinaryClientFormatterSinkProvider cli = new BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider slv = new BinaryServerFormatterSinkProvider();
slv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
Hashtable ht = new Hashtable();
ht["port"] = 2000;
TcpChannel c = new TcpChannel(ht, cli, slv);
ChannelServices.RegisterChannel(c, false);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(remotobject), "chatUri", WellKnownObjectMode.Singleton);
Console.WriteLine("Sunucu aktif");
string[] urls = c.GetUrlsForUri("chatUri");
客户端
BinaryClientFormatterSinkProvider cli = new BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider slv = new BinaryServerFormatterSinkProvider();
slv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
Hashtable ht = new Hashtable();
ht["port"] = 0;
TcpChannel c = new TcpChannel(ht, cli, slv);
ChannelServices.RegisterChannel(c, false);
RemotingConfiguration.RegisterWellKnownClientType(typeof(remotobject), "tcp://" + txtSunucu.Text.Trim() + ":2000/chatUri");
所以这是我的客户端和服务器我想知道的是如何在连接中找到私人消息的客户端ID?