Skip to content

Instantly share code, notes, and snippets.

@jbw
Created April 22, 2016 21:39
Show Gist options
  • Save jbw/fe2b0a766ef4cf5b867818e249a79020 to your computer and use it in GitHub Desktop.
Save jbw/fe2b0a766ef4cf5b867818e249a79020 to your computer and use it in GitHub Desktop.
using DotNetRemotingExample;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Text;
using System.Threading.Tasks;
namespace DotNetRemotingClient
{
/// <summary>
/// Clients
/// </summary>
class Program
{
static void Main(string[] args)
{
ChannelServices.RegisterChannel(new TcpClientChannel(), false);
RemotableType remoteType = (RemotableType)Activator.GetObject(typeof(RemotableType), "tcp://localhost:9932/RemotableType");
if (remoteType == null)
{
Console.WriteLine("Unable to get remote referance");
}
else
{
var response = remoteType.Connect();
Console.WriteLine(response);
var testObj = remoteType.GetNewTestObject();
Console.WriteLine("Id:" + testObj.Id);
}
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment