Sat Nov 08, 2008 1:34 am
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
namespace RemotingSamples
{
public class HelloServer
{
public static void Main(string [] args)
{
TcpServerChannel channel = new TcpServerChannel(8085);
//TcpChannel chan = new TcpChannel(8085);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Hello),"Hi",WellKnownObjectMode.SingleCall);
System.Console.WriteLine("<enter> to quite...");
System.Console.ReadLine();
}
}
}
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
namespace RemotingSamples
{
public class Client
{
[STAThread]
public static void Main(string [] args)
{
//TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(new TcpClientChannel());
Hello obj = (Hello)Activator.GetObject(typeof(Hello),"tcp://localhost:8085/Hi");
if (obj == null) System.Console.WriteLine("Could not find machine!");
else Console.WriteLine(obj.Greeting("John"));
//else Console.WriteLine(obj.HelloMethod("John"));
}
}
}
Sun Jan 20, 2013 9:25 pm
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.