Exemplo n.º 1
0
        public ServerCli(SchedulingServer server)
        {
            meetingProposals       = new List <MeetingProposal>();
            meetingProposalsBackup = new List <MeetingProposal> [0];
            meetingLocations       = new List <MeetingLocation>();
            clientsList            = new List <IClient>();
            currMPId    = 0;
            this.server = server;


            //freezing
            this.isFrozen = false;
            this.handler  = new EventWaitHandle(false, EventResetMode.ManualReset);
            this.frozenRequestsHandler = new EventWaitHandle(false, EventResetMode.ManualReset);
        }
        public static void Main(string[] args)
        {
            string[] vs = args[0].Split(
                new[] { "'" },
                StringSplitOptions.None);

            String id        = vs[0];
            String URL       = vs[1];
            int    maxFaults = Int32.Parse(vs[2]);
            int    minDelay  = Int32.Parse(vs[3]);
            int    maxDelay  = Int32.Parse(vs[4]);

            Uri myUri = new Uri(URL);

            TcpChannel channel = new TcpChannel(myUri.Port);

            ChannelServices.RegisterChannel(channel, false);

            SchedulingServer server = new SchedulingServer(id, URL, maxFaults, minDelay, maxDelay);
            ServerCli        mo     = new ServerCli(server);

            //RemotingServices.Marshal(mo, "mcm", typeof(ServerCli));

            RemotingServices.Marshal(mo, myUri.Segments[1], typeof(ServerCli));

            HttpChannel channel1 = new HttpChannel(myUri.Port + 200);

            ChannelServices.RegisterChannel(channel1, false);

            PuppetServer ps = new PuppetServer(mo);                   //testing this

            RemotingServices.Marshal(ps, "ps", typeof(PuppetServer)); // testing this

            Console.WriteLine("Server " + id + " started on Port " + myUri.Port);
            System.Console.ReadLine();
        }