rendered paste body//AJ: Shared assembly
using System;
using System.Collections.Generic;
using System.Text;
namespace Shared
{
public interface IServerClass
{
void SendText(string text);
}
}
//AJ: Client Console
using System;
using System.Collections.Generic;
using System.Text;
namespace Client
{
class Program
{
static void Main(string[] args)
{
System.Runtime.Remoting.Channels.Tcp.TcpClientChannel clientChan = new System.Runtime.Remoting.Channels.Tcp.TcpClientChannel();
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(clientChan, true);
Shared.IServerClass serverClass = (Shared.IServerClass)Activator.GetObject(typeof(Shared.IServerClass), "tcp://localhost:9999/ServerClass.rem");
while (true)
{
string input = Console.ReadLine();
if (input.ToLower() == "exit")
break;
serverClass.SendText(input);
}
}
}
}
//AJ: Server Console
using System;
using System.Collections.Generic;
using System.Text;
namespace Server
{
class Program
{
static void Main(string[] args)
{
System.Runtime.Remoting.Channels.Tcp.TcpServerChannel serverChan = new System.Runtime.Remoting.Channels.Tcp.TcpServerChannel(9999);
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(serverChan, true);
System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType(new System.Runtime.Remoting.WellKnownServiceTypeEntry(typeof(ServerClass), "ServerClass.rem", System.Runtime.Remoting.WellKnownObjectMode.SingleCall));
Console.ReadLine();
}
}
public class ServerClass : MarshalByRefObject, Shared.IServerClass
{
public void SendText(string text)
{
Console.WriteLine(text);
}
}
}