public void Init()
        {
            for (var i = 1; i <= _nServers; i++)
            {
                _serverList.Add(new ServerXL(RemotingEndpoint.BuildRemoteUrl("localhost", 8080 + i, "s" + i)));
            }

            Client1 = new ClientXL("tcp://localhost:8010/c1");
            Client2 = new ClientXL("tcp://localhost:8011/c2");
        }
Пример #2
0
        public void Init()
        {
            for (var i = 1; i <= _nServers; i++)
            {
                var url = RemotingEndpoint.BuildRemoteUrl("localhost", 8080 + i, "s" + i);
                var smr = new ServerSMR(url, _serverList.Select(server => server.EndpointURL).ToList());
                _serverList.Add(smr);
            }

            var serverUrls = _serverList.Select(server => server.EndpointURL).ToList();

            Client1 = new ClientSMR("tcp://localhost:8010/c1", serverUrls);
            Client2 = new ClientSMR("tcp://localhost:8011/c2", serverUrls);
        }
        /*
         * Arguments: SMR|XL [host port clientId]
         */
        public static void Main(string[] args)
        {
            if (args.Length != 1 && args.Length != 4)
            {
                throw new ArgumentException("Valid arguments: SMR|XL [host port clientId]");
            }

            var    implementation = args[0];
            Client client;
            var    remoteUrl = "";

            if (args.Length > 1)
            {
                var host     = args[1];
                var port     = int.Parse(args[2]);
                var serverId = args[3];
                remoteUrl = RemotingEndpoint.BuildRemoteUrl(host, port, serverId);
            }

            switch (implementation)
            {
            case "SMR":
            {
                client = remoteUrl == "" ? new ClientSMR() : new ClientSMR(remoteUrl);
                break;
            }

            case "XL":
            {
                client = remoteUrl == "" ? new ClientXL() : new ClientXL(remoteUrl);
                break;
            }

            default:
                throw new ArgumentException("First argument must be SMR or XL. It was: " + implementation);
            }

            Console.WriteLine("Client {0} running on {1} ...", implementation, client.EndpointURL);
            client.runScript();

            Console.ReadLine();

            //TODO interactive input or read script as in PuppetMaster
        }
Пример #4
0
        /*
         * Arguments: SMR|XL [host port serverId]
         */
        public static void Main(string[] args)
        {
            if (args.Length != 1 && args.Length != 4)
            {
                throw new ArgumentException("Valid arguments: SMR|XL [host port serverId]");
            }

            var    implementation = args[0];
            Server server;
            var    remoteUrl = "";

            if (args.Length > 1)
            {
                var host     = args[1];
                var port     = int.Parse(args[2]);
                var serverId = args[3];
                remoteUrl = RemotingEndpoint.BuildRemoteUrl(host, port, serverId);
            }

            switch (implementation)
            {
            case "SMR":
            {
                server = remoteUrl == "" ? new ServerSMR() : new ServerSMR(remoteUrl);
                break;
            }

            case "XL":
            {
                server = remoteUrl == "" ? new ServerSMR() : new ServerSMR(remoteUrl);     //TODO change to ServerXL
                break;
            }

            default:
                throw new ArgumentException("First argument must be SMR or XL. It was: " + implementation);
            }

            Console.WriteLine("Server {0} running on {1} ...", implementation, server.EndpointURL);
            Console.ReadLine();
        }