如何去注册多个TCP/HTTP通道 ?
我在学习Remoting 的时,我想把一个程序做成即是服务器又是客户端,
那么就去注册两个TCP ,一个用了监听客户端,一个用于和另一个服务器端进行通信
程序大致如下:
TcpChannel tcpService = new TcpChannel(8089);
ChannelServices.RegisterChannel(tcpService );
RemotingConfiguration.RegisterWellKnownServiceType(typeof(showMessage.showmsg), "tcpChart", WellKnownObjectMode.Singleton);
/*******************/
TcpChannel tcpClient = new TcpChannel();
ChannelServices.RegisterChannel(tcpClient ); showMessage.showmsg msg = (showMessage.showmsg ) Activator.GetObject(typeof(showMessage.showmsg),"tcp://localhost:8088/tcpChart");
while(true)
{
string msgstr = Console.ReadLine();
msg.show(msgstr);
}
可是当再去注册第二个TCP时出错: TCP通道已注册。。。。
请高手帮我解释一下,是程序问题呢? 还是其它的原因? 为什么不能注册两个TCP通道