示例#1
0
        static void Main(string[] args)
        {
            ModeTracker modeTracker = new ModeTracker();

            IPAddress address, masterAddress;
            int port, masterPort;

            // Set up configuration
            string inputLine = "";
            foreach (string arg in args)
                inputLine += arg + " ";

            InputParser inputParser = new InputParser(inputLine);
            inputParser.ParseInput();

            address = getIPAddress();
            port = inputParser.Port;

            // If address was given 
            if (inputParser.MasterAddress == null)
            {
                primaryMode = true;

                modeTracker.InitiatePrimary(address, port);
            }
            else 
            {
                primaryMode = false;
                masterAddress = inputParser.MasterAddress;
                masterPort = inputParser.MasterPort;

                modeTracker.InitiateBackup(address, port, masterAddress, masterPort);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            ModeTracker modeTracker = new ModeTracker();

            IPAddress address, masterAddress;
            int       port, masterPort;

            // Set up configuration
            string inputLine = "";

            foreach (string arg in args)
            {
                inputLine += arg + " ";
            }

            InputParser inputParser = new InputParser(inputLine);

            inputParser.ParseInput();

            address = getIPAddress();
            port    = inputParser.Port;

            // If address was given
            if (inputParser.MasterAddress == null)
            {
                primaryMode = true;

                modeTracker.InitiatePrimary(address, port);
            }
            else
            {
                primaryMode   = false;
                masterAddress = inputParser.MasterAddress;
                masterPort    = inputParser.MasterPort;

                modeTracker.InitiateBackup(address, port, masterAddress, masterPort);
            }
        }