using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Runtime; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; using System.Runtime.Remoting.Channels.Http; namespace RemotingXPClient { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnTest_Click(object sender, EventArgs e) { //TcpClientChannel tcpclient = new TcpClientChannel(); //ChannelServices.RegisterChannel(tcpclient, true); HttpClientChannel httpclient = new HttpClientChannel(); ChannelServices.RegisterChannel(httpclient,false); HelloRemoting.Hello obj = (HelloRemoting.Hello)Activator.GetObject(typeof(HelloRemoting.Hello), "http://192.168.0.246:10096/Hi"); MessageBox.Show(obj.Test()); ChannelServices.UnregisterChannel(httpclient); //ChannelServices.UnregisterChannel(tcpclient); } private void btnCreateText_Click(object sender, EventArgs e) { //BinaryClientFormatterSinkProvider c = new BinaryClientFormatterSinkProvider(); //TcpClientChannel tcpclient = new TcpClientChannel("tcp1",c); //ChannelServices.RegisterChannel(tcpclient, true); HttpClientChannel httpclient = new HttpClientChannel(); ChannelServices.RegisterChannel(httpclient, false); HelloRemoting.Hello obj = (HelloRemoting.Hello)Activator.GetObject(typeof(HelloRemoting.Hello), "http://192.168.0.246:10096/Hi"); obj.CreateFile(); ChannelServices.UnregisterChannel(httpclient); } private void btnDeleteTxt_Click(object sender, EventArgs e) { //BinaryClientFormatterSinkProvider c = new BinaryClientFormatterSinkProvider(); //TcpClientChannel tcpclient = new TcpClientChannel("tcp2", c); //ChannelServices.RegisterChannel(tcpclient, true); HttpClientChannel httpclient = new HttpClientChannel(); ChannelServices.RegisterChannel(httpclient, false); HelloRemoting.Hello obj = (HelloRemoting.Hello)Activator.GetObject(typeof(HelloRemoting.Hello), "http://192.168.0.246:10096/Hi"); obj.DeleteFile(); ChannelServices.UnregisterChannel(httpclient); } } }