Click here to Skip to main content
15,896,497 members
Articles / Programming Languages / C#

.NET Remoting: Passing through the obstacles path from version 1.0 to 1.1

Rate me:
Please Sign up or sign in to vote.
4.73/5 (68 votes)
31 Mar 20042 min read 221.5K   3.3K   40  
Houston, we have a problem. One small step for mankind, one Giant irritation for developers.
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Collections;
using System.Runtime.Serialization.Formatters;
using SharedAssembly;

namespace ServerAssembly
{
	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	
	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	class Server
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{


			/*TcpChannel channel = new TcpChannel(6123);
			ChannelServices.RegisterChannel(channel);*/

			BinaryClientFormatterSinkProvider clientProvider = null;
			BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
			serverProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
				
			IDictionary props = new Hashtable();
			props["port"] = 6123;
			props["typeFilterLevel"] = TypeFilterLevel.Full;
			TcpChannel chan = new TcpChannel(
				props,clientProvider,serverProvider);

			ChannelServices.RegisterChannel(chan);

			

//just for debugging
				RemotingConfiguration.RegisterWellKnownServiceType(
					typeof(SharedObj),
					"ParachuteExample",
					WellKnownObjectMode.Singleton);

				WellKnownServiceTypeEntry[] wkste= RemotingConfiguration.GetRegisteredWellKnownServiceTypes();
				string s = wkste[0].ObjectUri;

				Console.WriteLine("Display well known service types");
				WellKnownServiceTypeEntry[] WellKnownServiceTypeEntries = RemotingConfiguration.GetRegisteredWellKnownServiceTypes();
				foreach(WellKnownServiceTypeEntry entry in WellKnownServiceTypeEntries)
					Console.WriteLine(string.Format("{0}", entry));

				
				Console.WriteLine("Display registerd channels");
				IChannel[] Channels = ChannelServices.RegisteredChannels;
				foreach(IChannel chn in Channels)
					Console.WriteLine(string.Format("Channel-Name='{0}'; Priority='{1}'", chn.ChannelName, chn.ChannelPriority));

			Console.WriteLine();
			Console.WriteLine("Any key to exit");
			Console.ReadLine();
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Israel Israel
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions