C
Clinton Pierce
I've got a class that I want to access remotely. The touble is, I can't
figure out how to call the constructor of the class with arguments -- and
the arguments are necessary to initialize the class.
For example, here's my code on the client end:
static void Main(string[] args)
{
HttpChannel chan = new HttpChannel(0);
ChannelServices.RegisterChannel(chan);
MarshalByRefObject obj = (MarshalByRefObject)
RemotingServices.Connect(typeof(PR1.Client),
"http://127.0.0.1:65100/theEndPoint");
try
{
PR1.Client c = obj as PR1.Client;
string s = c.ClientName;
Console.WriteLine("Name: " + s);
}
catch (System.Exception ex)
{
Console.WriteLine("Exception caught: \n" + ex.Message);
}
return;
}
The constructor for client requires that I pass in 3 strings as arguments.
How do I do this?
figure out how to call the constructor of the class with arguments -- and
the arguments are necessary to initialize the class.
For example, here's my code on the client end:
static void Main(string[] args)
{
HttpChannel chan = new HttpChannel(0);
ChannelServices.RegisterChannel(chan);
MarshalByRefObject obj = (MarshalByRefObject)
RemotingServices.Connect(typeof(PR1.Client),
"http://127.0.0.1:65100/theEndPoint");
try
{
PR1.Client c = obj as PR1.Client;
string s = c.ClientName;
Console.WriteLine("Name: " + s);
}
catch (System.Exception ex)
{
Console.WriteLine("Exception caught: \n" + ex.Message);
}
return;
}
The constructor for client requires that I pass in 3 strings as arguments.
How do I do this?