Inheritance: IChannelReceiver, IChannel, ISecurableChannel
Example #1
0
        public bool Regist(IList<ServiceInfo> serviceList = null)
        {
            try
              {
            var serverChannel = new TcpServerChannel(channel);
            ChannelServices.RegisterChannel(serverChannel, false);
            if (serviceList != null)
            {
              foreach (ServiceInfo serviceInfo in serviceList)
              {
            RemotingConfiguration.RegisterWellKnownServiceType(serviceInfo.Type, serviceInfo.Name, serviceInfo.Mode);
            Console.WriteLine("Service {0} has been started.", serviceInfo.Name);
              }
            }
            Console.WriteLine("Channel Name:{0}", serverChannel.ChannelName);
            Console.WriteLine("Channel Priority:{0}", serverChannel.ChannelPriority);

            var data = (ChannelDataStore)serverChannel.ChannelData;
            foreach (string channelUri in data.ChannelUris)
            {
              Console.WriteLine("Uri:{0}", channelUri);
            }
            Console.WriteLine("Start listening");
            return true;
              }
              catch
              {
            Console.WriteLine("Service channel has not regist.");
            return false;
              }
        }
Example #2
0
        static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                string usage =
            @"PingServer 0.003 gamma. Server application for testing remoting ping.

            Usage: PingServer <port> <name>

            port:     tcp port
            name:     guid";

                Logger.LogLine(usage);
                return;
            }

            int port = int.Parse(args[0]);
            string name = args[1];

            TcpServerChannel channel = new TcpServerChannel(port);
            ChannelServices.RegisterChannel(channel);

            RemotingConfiguration.RegisterWellKnownServiceType(typeof(WipClusterPeer), name, WellKnownObjectMode.SingleCall);

            Logger.LogLine("Listening on port " + port + " with name '" + name + "'");

            do
            {
                System.Threading.Thread.Sleep(200);
            }
            while (!Console.KeyAvailable);

            return;
        }
Example #3
0
        public static void Main(string[] args)
        {
            TrackingServices.RegisterTrackingHandler(new TrackingHandler());

            TcpServerChannel tcpChannel = new TcpServerChannel(8086);

            //			HttpServerChannel httpChannel = new HttpServerChannel(8085);

             Console.WriteLine();
            /*
            foreach (object o in httpChannel)
            {
                Console.WriteLine(o);
            }
            foreach (object key in httpChannel.Keys)
            {
                Console.WriteLine(key + ": " + httpChannel[key]);
            }
            */

            ChannelServices.RegisterChannel(tcpChannel);
            //	ChannelServices.RegisterChannel(httpChannel);

            RemotingConfiguration.RegisterWellKnownServiceType(
                typeof (Wrox.ProfessionalCSharp.Hello), // Type
                "Hi",									// URI
                WellKnownObjectMode.SingleCall);		// Mode

            System.Console.WriteLine("hit to exit");
            System.Console.ReadLine();
        }
Example #4
0
        public void Start()
        {
            try
            {
                // Register TCP Channel
                channel = new TcpServerChannel( "Archiver", Constants.TCPListeningPort );
                System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel, false);

                // Register the SAO
                RemotingConfiguration.RegisterWellKnownServiceType( typeof(ArchiveServer),
                    "ArchiveServer", WellKnownObjectMode.Singleton );

                string configFileName = System.Reflection.Assembly.GetEntryAssembly().Location + ".config";
                if (System.IO.File.Exists(configFileName))
                {
                    RemotingConfiguration.Configure(configFileName, false);
                }

                eventLog.WriteEntry(Strings.ArchiveServiceStarted, EventLogEntryType.Information, 
                    ArchiveServiceEventLog.ID.Information);
            }
            catch
            {
                if ( channel != null )
                {
                    channel.StopListening(null);
                    ChannelServices.UnregisterChannel(channel);
                }
            }
        }
Example #5
0
        protected override void OnStart(string[] args)
        {
			Status("", true);
			Status("The ChatServer is initializing...", true);

            //log service initializing
            _port = SelectServerPort();
			Status("Done SelectServerPort...", true);
			//_server = ChatServer.Factory(_port);
            
			//_backgroundThread = new Thread(new ThreadStart(this.RunServer));
			//_backgroundThread.Start();
			//LogApplicationEvent("Start", "The ChatServer has successfully started up on port " + _port);
			
			LifetimeServices.LeaseTime = TimeSpan.FromDays(365);
			LifetimeServices.RenewOnCallTime = TimeSpan.FromDays(365);


			//Set up the channel details
			BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider();
			provider.TypeFilterLevel = TypeFilterLevel.Full;
			Status("Done BinaryServerFormatterSinkProvider...", true);

			string address = ChatServer.ChatServerIp;// ChatServer.GetMyIP();
			Hashtable props = new Hashtable();
			props.Add("port", _port);
			props.Add("bindTo", address);
			props.Add("name", "Address:" + address + ":" + _port);//this needs to be unique
			Status("Init on address:" + address + ":" + _port, true);
			
			//Create the channel
			TcpServerChannel chan = new TcpServerChannel(props, provider);
			Status("Done TcpServerChannel...", true);

			//register it
			ChannelServices.RegisterChannel(chan, false);
			Status("Done RegisterChannel", true);

			//register the object as a service
			RemotingConfiguration.RegisterWellKnownServiceType(typeof(ChatServer), "Reg", WellKnownObjectMode.Singleton);
			Status("Done RegisterWellKnownType", true);

			_server = new ChatServer(new ChatServer.StatusDelegate(Status));
			Status("Done ChatServer...", true);
			
			RemotingServices.Marshal(_server, "Reg");
			Status("Done RemotingServices.Marshal...", true);
			
			//_server.Setup(_port);
			Status("Done Setup...", true);

			_backgroundThread = new Thread(new ThreadStart(this.RunServer));
			_backgroundThread.Start();
			Status("Done Start...", true);

			//LogApplicationEvent("Start", "The ChatServer has successfully started up on port " + _port);

            
        }
Example #6
0
 static void Main(string[] args)
 {
     TcpServerChannel channel = new TcpServerChannel(33000);
     ChannelServices.RegisterChannel(channel, false);
     RemotingConfiguration.RegisterWellKnownServiceType(typeof(MyService),
             "MyServiceUri", WellKnownObjectMode.SingleCall); 
     Console.ReadKey();
 }
Example #7
0
 static void Main()
 {
     RemotingConfiguration.RegisterWellKnownServiceType(typeof(FileServer), "MyFileServer", WellKnownObjectMode.SingleCall);
     TcpServerChannel channel = new TcpServerChannel(1244);
     ChannelServices.RegisterChannel(channel,true);
     Console.WriteLine("File server started. Press enter to terminate...");
     Console.ReadLine();
 }
Example #8
0
 /// <summary>
 /// 创建remoting的服务器端
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     /// //建立服务传输方式,可选择TCP或者HTTP,前者更能发挥高效性
     TcpServerChannel tcp = new TcpServerChannel(8089);
     /// //注册通道
     ChannelServices.RegisterChannel(tcp, false);
     //添加可调用的远程对象,WellKonwnObjectMode可选择为SingleTon或者SingleCall
     RemotingConfiguration.RegisterWellKnownServiceType(typeof(PersonManager), "PersonUri", WellKnownObjectMode.Singleton);
 }
Example #9
0
 static void Main(string[] args)
 {
     TcpServerChannel channel = new TcpServerChannel(6666);
     ChannelServices.RegisterChannel(channel);
     RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemoteObject),
         "RemoteObject", WellKnownObjectMode.SingleCall);
     System.Console.WriteLine("Press Any Key");
     System.Console.ReadLine();
     Console.Read();
 }
Example #10
0
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            TcpServerChannel server = new TcpServerChannel(2000);
            ChannelServices.RegisterChannel(server);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(MyServer), "teste", WellKnownObjectMode.Singleton);
        }
Example #11
0
        public TcpRemotingServer(string channelName, string serviceUri, int port, object remotingObject)
        {
            this.remotingObject = remotingObject;
            SecureServerChannelSinkProvider sSink = GetSecureServerSink();

            tcpChannel = new TcpServerChannel(channelName, port, sSink);

            RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;

            RemotingConfiguration.RegisterWellKnownServiceType(remotingObject.GetType(), serviceUri, WellKnownObjectMode.Singleton);
        }
Example #12
0
 /// <summary>
 /// when big boring button is clicked start to listen on port 9000
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void start_Click(object sender, EventArgs e)
 {
     TcpServerChannel channel = new TcpServerChannel(9000);
     ChannelServices.RegisterChannel(channel, false);
     WellKnownServiceTypeEntry remObj = new WellKnownServiceTypeEntry
     (
     typeof(RemoteApp.RemoteApp),
     "remoteapp",
     WellKnownObjectMode.Singleton
     );
     RemotingConfiguration.RegisterWellKnownServiceType(remObj);
 }
        public static void createChannelTcp()
        {
            TcpServerChannel chan = new TcpServerChannel(ZifliService._PORT);
            ChannelServices.RegisterChannel(chan, false);
            Logger.WriteEvent("Server channel created.", ZifliService._DEBUG);

            RemotingConfiguration.RegisterWellKnownServiceType(
                Type.GetType("ZifliService.remotingController"),
                "ZifliServer",
                WellKnownObjectMode.Singleton);
            Logger.WriteEvent("Singleton created.", ZifliService._DEBUG);
        }
Example #14
0
        protected override void OnStart(string[] args)
        {
            BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider();
            provider.TypeFilterLevel = TypeFilterLevel.Full;
            // Creating the IDictionary to set the port on the channel instance.
            IDictionary props = new Hashtable();
            props["port"] = 1111;

            TcpServerChannel channel = new TcpServerChannel(props,provider);
            ChannelServices.RegisterChannel(channel, false);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(PasswordServer.DatabaseInfo), "DatabaseInfo", WellKnownObjectMode.Singleton);
        }
Example #15
0
        public void Destroy()
        {
            // Clean up the coordinator
            Coordinator.Destroy();

            // Free up the remoting channel
            if( ServerChannel != null )
            {
                ChannelServices.UnregisterChannel( ServerChannel );
                ServerChannel = null;
            }
        }
        public RemotingManagementSessionFactoryHost(string uri)
        {
            var parsedUri = new Uri(uri);

            if (parsedUri.Scheme != "tcp" || parsedUri.Host != "localhost" || parsedUri.Segments.Length != 2)
                throw new ArgumentException("uri");

            channel = new TcpServerChannel(parsedUri.Port);
            ChannelServices.RegisterChannel(channel, false);
            factory = new RemotingManagementSessionFactory();
            RemotingServices.Marshal(factory, parsedUri.Segments[1]);
        }
Example #17
0
        static void Main()
        {
            //Создание и регистрирование канала TCP
            var channel = new TcpServerChannel(8086);
            ChannelServices.RegisterChannel(channel, true);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(Box), "Hi", WellKnownObjectMode.Singleton);

            //Задержка работы сервера
            Console.WriteLine("Сервер запущен");
            Console.WriteLine("Для завершения нажмите Enter");
            Console.ReadLine();
        }
		void Init (IDictionary properties, IClientChannelSinkProvider clientSink, IServerChannelSinkProvider serverSink)
		{
			_clientChannel = new TcpClientChannel (properties,clientSink);

			if(properties["port"] != null)
				_serverChannel = new TcpServerChannel(properties, serverSink);

			object val = properties ["name"];
			if (val != null) _name = val as string;
			
			val = properties ["priority"];
			if (val != null) _priority = Convert.ToInt32 (val);
		}
		public static string StartServer(int port, string[] args)
		{
			TcpServerChannel channel = new TcpServerChannel(port);
			ChannelServices.RegisterChannel(channel);
			string uri = channel.GetChannelUri() + "/DebuggerService";
			
			DebuggerService debuggerService = new DebuggerService(args);
			RemotingServices.Marshal(debuggerService, "DebuggerService");
			
			Console.WriteLine("Listening at " + uri);
			
			return uri;
		}
Example #20
0
        public TcpRemotingServer(string channelName, string serviceUri, int port, MarshalByRefObject remotingObject)
        {
            this.remotingObject = remotingObject;

            SecureServerChannelSinkProvider sSink = GetSecureServerSink();
            tcpChannel = new TcpServerChannel(channelName, port, sSink);

            if (RemotingConfiguration.CustomErrorsMode != CustomErrorsModes.Off)
            {
                RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
            }

            RemotingServices.Marshal(remotingObject, serviceUri);
        }
Example #21
0
		/// <summary>
		/// Registers the BoxRemote class for remote access on the server system
		/// </summary>
		private static void StartServer( object obj )
		{
			TcpServerChannel channel = new TcpServerChannel( "boxserver", BoxConfig.Port );
			ChannelServices.RegisterChannel( channel );

			RemotingConfiguration.RegisterWellKnownServiceType( typeof( BoxRemote ), "BoxRemote", WellKnownObjectMode.Singleton );

			Console.WriteLine( "Pandora is listening on port {0} - BoxServer version {1}", BoxConfig.Port, m_Version );

			while ( true )
			{
				Thread.Sleep( 30000 );
			}
		}
Example #22
0
        static void Main(string[] args)
        {
            /* Uncomment out the Setting Channel Properties region for page 15 of the chapter.
             * Then comment out the TcpChannels region
             * */

            #region Setting Channel Properties
            IDictionary properties = new Hashtable();
            properties["name"] = "TCP Channel with a SOAP Formatter";
            properties["priority"] = "20";
            properties["port"] = "8086";
            SoapServerFormatterSinkProvider sinkProvider =
                new SoapServerFormatterSinkProvider();
            TcpServerChannel tcpChannel =
                new TcpServerChannel(properties, sinkProvider);
            ShowChannelProperties(tcpChannel);
            #endregion

            #region TcpChannels

            //	TcpServerChannel tcpChannel = new TcpServerChannel(8086);
            //	ShowChannelProperties(tcpChannel);
            #endregion

            #region HttpChannel
            HttpServerChannel httpChannel = new HttpServerChannel(8085);
            ShowChannelProperties(httpChannel);
            #endregion

            #region RegisterChannels

            ChannelServices.RegisterChannel(tcpChannel);
            ChannelServices.RegisterChannel(httpChannel);

            #endregion

            /*
            HttpServerChannel channel =
                (HttpServerChannel)ChannelServices.GetChannel("http");
            channel.StopListening(null);
            */
            RemotingConfiguration.RegisterWellKnownServiceType(
                typeof(Hello),
                "Hi",
                WellKnownObjectMode.SingleCall);

            System.Console.WriteLine("hit to exit");
            System.Console.ReadLine();
        }
Example #23
0
 static void Main(string[] args)
 {
     try
     {
         TcpServerChannel channel = new TcpServerChannel(2345);
         ChannelServices.RegisterChannel(channel, false);
         RemotingConfiguration.RegisterWellKnownServiceType(typeof(ServiceServer), "IIssuerService", WellKnownObjectMode.SingleCall);
         Console.WriteLine("Server is running");
         Console.ReadLine();
     }
     catch
     {
         Console.WriteLine("Can't start server");
     }
 }
Example #24
0
File: Server.cs Project: mono/gert
		static void Main ()
		{
			TcpServerChannel channel = new TcpServerChannel (7777);
#if NET_2_0
			ChannelServices.RegisterChannel (channel, false);
#else
			ChannelServices.RegisterChannel (channel);
#endif
			RemotingConfiguration.RegisterWellKnownServiceType (
				typeof (RemoteObject),
				"remote-object",
				WellKnownObjectMode.Singleton
			);
			Console.ReadLine ();
		}
 public TcpChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)
 {
     this._channelPriority = 1;
     this._channelName = "tcp";
     Hashtable hashtable = new Hashtable();
     Hashtable hashtable2 = new Hashtable();
     bool flag = false;
     if (properties != null)
     {
         foreach (DictionaryEntry entry in properties)
         {
             string key = (string) entry.Key;
             if (key == null)
             {
                 goto Label_00CB;
             }
             if (!(key == "name"))
             {
                 if (key == "priority")
                 {
                     goto Label_0097;
                 }
                 if (key == "port")
                 {
                     goto Label_00B5;
                 }
                 goto Label_00CB;
             }
             this._channelName = (string) entry.Value;
             continue;
         Label_0097:
             this._channelPriority = Convert.ToInt32((string) entry.Value, CultureInfo.InvariantCulture);
             continue;
         Label_00B5:
             hashtable2["port"] = entry.Value;
             flag = true;
             continue;
         Label_00CB:
             hashtable[entry.Key] = entry.Value;
             hashtable2[entry.Key] = entry.Value;
         }
     }
     this._clientChannel = new TcpClientChannel(hashtable, clientSinkProvider);
     if (flag)
     {
         this._serverChannel = new TcpServerChannel(hashtable2, serverSinkProvider);
     }
 }
        static void Main(string[] args)
        {
            bool ensureSecurity = false;
            TcpServerChannel channel = new TcpServerChannel(8086);
            ChannelServices.RegisterChannel(channel, ensureSecurity);
            #if true
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(NetRemotingObjects.Hello), "Hi", WellKnownObjectMode.SingleCall);
            #else
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(NetRemotingObjects.Hello), "Hi", WellKnownObjectMode.Singleton);
            #endif

            Console.WriteLine("a .NET Remoting server is running ...");

            Console.WriteLine("press any key to exit ...");
            Console.ReadKey(true);
        }
Example #27
0
        protected override void OnStart(string[] args)
        {
            refMgr.StartReflector();

            // Register the server channel.
            IDictionary channelProperties = new Hashtable();
            channelProperties["port"] = ConfigurationManager.AppSettings.Get(AppConfig.AdminPort);
            channelProperties["rejectRemoteRequests"] = true;

            channel = new TcpServerChannel(channelProperties, null);
            ChannelServices.RegisterChannel(channel, false);

            // Expose an object for remote calls
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(AdminRemoting), 
                "ReflectorAdminEndpoint", WellKnownObjectMode.Singleton);
        }
Example #28
0
 public void Start()
 {
     this.m_Timer = new Timer(1000); // First one should trigger in 1 second.
     this.m_Timer.Elapsed += new ElapsedEventHandler(m_Timer_Elapsed);
     this.m_Timer.AutoReset = true;
     this.m_Timer.Start();
     this.m_InterProcess = new InterProcess();
     InterProcess.RegisterRequestedEvent += new ApplicationInstanceEventHandler(m_InterProcess_RegisterRequestedEvent);
     InterProcess.ScheduledUpdateRequestedEvent += new ApplicationInstanceEventHandler(m_InterProcess_ScheduledUpdateRequestedEvent);
     InterProcess.HasUpdatesRequestedEvent += new ApplicationInstanceEventHandler(m_InterProcess_HasUpdatesRequestedEvent);
     Dictionary<object, object> simple = new Dictionary<object, object>();
     simple.Add("port", 38088);
     simple.Add("bindTo", "127.0.0.1");
     this.m_IPC = new TcpServerChannel(simple, null);
     ChannelServices.RegisterChannel(this.m_IPC, true);
     RemotingConfiguration.RegisterWellKnownServiceType(typeof(InterProcess), "interprocess", WellKnownObjectMode.Singleton);
 }
Example #29
0
        public CRemoting()
        {
            //
            // TODO: agregar aquí la lógica del constructor
            //
            puerto = CKernel.Preferences.GetInt("RemoteControlPort",4670);
            IPPermitida = CKernel.Preferences.GetStringArray("AllowedIP");
            Hashtable props = new Hashtable();
            props.Add("name","eLePhantService");
            props.Add("priority","10"); //en la ayuda pone que son enteros, pero con ellos da error de conversion.
            props.Add("port", puerto);
            props.Add("supressChannelData",true);
            props.Add("useIpAddress",true);
            props.Add("rejectRemoteRequests",false);

            #if (!COMPRESSION)

            BinaryServerFormatterSinkProvider provider =
                new BinaryServerFormatterSinkProvider();
            provider.TypeFilterLevel =
                System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
            m_lPhantChannel = new TcpServerChannel(props, provider);
            ChannelServices.RegisterChannel(m_lPhantChannel);
            #else
            //Iniciacion
            Hashtable propsinks = new Hashtable();
            propsinks.Add("includeVersions",true);
            propsinks.Add("typeFilterLevel","Full");
            Hashtable datasinks = new Hashtable();

            //2ª Opcion
            eLePhantServerSinkProvider provider =
                new eLePhantServerSinkProvider(propsinks,datasinks);

            //Creacion
            m_lPhantChannel = new TcpServerChannel(props, provider);
            ChannelServices.RegisterChannel(m_lPhantChannel);

            #endif
            RemotingConfiguration.RegisterWellKnownServiceType(
                typeof(CInterfaceGateway),
                "InterfazRemota",
                WellKnownObjectMode.Singleton);
        }
 protected override void StartImpl()
 {
     this._channel = new TcpServerChannel(new Dictionary<Object, Object>()
     {
         {"name", "tcp server " + this},
         {"bindTo", this._bindAddress},
         {"port", this._portNumber},
         {"useIpAddress", false},
     }, new BinaryServerFormatterSinkProvider()
     {
         TypeFilterLevel = TypeFilterLevel.Full,
     });
     ChannelServices.RegisterChannel(this._channel, false);
     String uri = "tcp://localhost:" + this._portNumber + RemotingServices.Marshal((MarshalByRefObject) this.Host, "core", typeof(IServerCore)).URI;
     this.Log.Info("TCP Remoting URI is: {0}", uri);
     this.Host.Directories.RuntimeDirectory
         .File(this + ".uri")
         .WriteAllText(uri);
 }