111,120
社区成员
发帖
与我相关
我的任务
分享namespace MonthListClient
{
public partial class FormMonthListClient : Form
{
public FormMonthListClient()
{
InitializeComponent();
HttpChannel c = new HttpChannel();
ChannelServices.RegisterChannel(c);
}
private void receive_Click(object sender, EventArgs e)
{
MonthServer.MonthList monthlist = (MonthServer.MonthList)Activator.GetObject(typeof(MonthServer.MonthList), "http://localhost:8081/Monthlist");
this.Monthlist.DataSource = monthlist.getCountryList();
}
private void FormMonthListClient_Load(object sender, EventArgs e)
{
}
}
}namespace MonthListHost
{
class MonthListHost
{
static void Main(string[] args)
{
HttpChannel myChannel = new HttpChannel(8080);
ChannelServices.RegisterChannel(myChannel);
RemotingConfiguration.RegisterWellKnownClientType(typeof(MonthServer.MonthList), "MonthList");
System.Console.WriteLine("press enter to exit");
System.Console.ReadLine();
}
}
}
namespace MonthAccess
{
public class MonthList : MarshalByRefObject
{
private string[] month ={ "1", "2", "3", "4", "5", "6" };
public MonthList()
{
}
public String[] getCountryList()
{
return month;
}
}
}