Пример #1
0
        private void Connect()
        {
            //root = Activator.GetObject(typeof(Root), "tcp://localhost:8080/Root") as Root;
            root = Activator.GetObject(typeof(LibraryRoot), "tcp://localhost:8080/LibraryRoot") as LibraryRoot;

            //_addressBook.Changed += new AddressBookChangedEventHandler(AddressBook_Changed);

            //_statusBar.Text = "Connected";
        }
Пример #2
0
        public static void Main(string[] args)
        {
            //ChannelServices.RegisterChannel(new TcpChannel(8080));
            BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider(); provider.TypeFilterLevel = TypeFilterLevel.Full;
            IDictionary props = new Hashtable();
            props["port"] = 8080;
            ChannelServices.RegisterChannel(new TcpChannel(props, null, provider));

            //PrevalenceEngine engine = PrevalenceActivator.CreateTransparentEngine(typeof(Root), Path.Combine(Environment.CurrentDirectory, "data"));
            //Root root = engine.PrevalentSystem as Root;

            // Let's take a complete snapshot of the system
            // each 30 seconds...
            //            SnapshotTaker st = new SnapshotTaker(engine, 30000);

            //ObjRef reference = RemotingServices.Marshal(root, "Root", typeof(Root));
            LibraryRoot root = new LibraryRoot();
            ObjRef reference = RemotingServices.Marshal(root, "LibraryRoot", typeof(LibraryRoot));
            Console.WriteLine("server running... press <ENTER> to finish");
            Console.ReadLine();

            RemotingServices.Unmarshal(reference);
        }