Oli999
asked on
.net remoting c# example
Hi Experts,
I've been struggling with c# .net remoting examples but i'm not having much look. i've tried this one un-successfully:
http://www.developer.com/net/cplus/article.php/1479761
Does anyone have any examples of ones that they know work 100%
Cheers
I've been struggling with c# .net remoting examples but i'm not having much look. i've tried this one un-successfully:
http://www.developer.com/net/cplus/article.php/1479761
Does anyone have any examples of ones that they know work 100%
Cheers
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
using System;
namespace Bhupinder.Remoting.MarshOb
{
public class Greatings : MarshalByRefObject
{
public Greatings()
{
Console.WriteLine("Constru
}
~Greatings()
{
Console.WriteLine("Deconst
}
public void PrintText(string txt)
{
Console.WriteLine("Hey you need to print : {0}",txt);
}
}
}
//************************
//Code for the Server
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Ch
using System.Runtime.Remoting.Ch
namespace Bhupinder.Remoting.Server
{
class ServerClass
{
static void Main(string[] args)
{
HttpChannel httpchn = new HttpChannel(8080);
ChannelServices.RegisterCh
RemotingConfiguration.Regi
(typeof(Bhupinder.Remoting
WellKnownObjectMode.Single
Console.WriteLine("Press any key to end the server....");
Console.ReadLine();
}
}
}
//************************
//Code for the Client
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Ch
using System.Runtime.Remoting.Ch
using Bhupinder.Remoting.MarshOb
namespace Bhupinder.Remoting.Remotin
{
class Program
{
static void Main(string[] args)
{
HttpChannel httpchn = new HttpChannel();
ChannelServices.RegisterCh
Greatings grt = (Greatings)Activator.GetOb
if (grt == null)
{
Console.WriteLine("Server down please try again after sometime");
Console.ReadLine();
}
else
{
grt.PrintText("This will be printed...");
Console.ReadLine();
}
}
}
}
//***********************
The three sections above must be saved in three different files/projects..
A reference of System.Runtime.Remoting should be added to Server and the client.
This is a working version i have just checked before posting this...
rinks