Ejemplo n.º 1
0
 // Constructor WIN
 public ClientUnitTests()
 {
     ConfigReader.ReadFile ("/home/nightstrike/programming/mono/radical/client/client.config");
     m_client1 = new Client();
     m_client1.LoadConfig();
     m_client1.InitClient ();
 }
Ejemplo n.º 2
0
        /*
         * There are two ways to start a client:
         * 1) with a full config file
         * 2) with a Username, Port and Default config file
         */
        public static void Main(string[] args)
        {
            // some sanity checks
            if (args.Length < 1)
            {
                Usage ();
                Environment.Exit(0);
            }

            Client client = new Client ();

            if (args.Length == 1) {
                // only for stress testing
                if (args[0].Equals ("--stress"))
                {
                    StressTestClient stc = new StressTestClient ();
                    stc.Run ();
                    Console.ReadLine ();
                    Console.WriteLine ("Exiting stress test");
                    Environment.Exit (0);
                }

                // normal case
                if (!ConfigReader.ReadFile (args[0]))
                    Environment.Exit (0);

                client.LoadConfig ();
            }
            else if (args.Length == 3)
            {
                // start from puppet master
                if (!ConfigReader.ReadFile (args[2]))
                    Environment.Exit (0);

                try
                {
                    client.LoadConfig (args[0], Int32.Parse (args[1]));
                }
                catch (FormatException fe)
                {
                    Console.WriteLine ("Invalid port.");
                    Environment.Exit (0);
                }
            }
            else
            {
                Usage ();
                Environment.Exit (0);
            }

            client.InitClient ();

            Console.ReadLine();
        }
Ejemplo n.º 3
0
            public void SpawnClient()
            {
                string user = String.Format ("user-{0}", START_PORT+callback.m_currentPortOffset);

                Console.WriteLine ("Creating client: {0}", user);
                Client client = new Client ();
                client.LoadConfig (user, START_PORT+callback.m_currentPortOffset);

                callback.UpdateCounter ();

                client.InitClient ();

                Console.WriteLine ("Connecting: {0}", user);
                client.Connect ();

                for (int i = 0; i < REQUESTS; i++)
                {
                    Thread.Sleep (randomizer.Next (1000));
                    Console.WriteLine ("Ask Sequence number: {0}", user);
                    client.GetSequenceNumber ();
                }

                Thread.Sleep (randomizer.Next (1000));
                Console.WriteLine ("Disconnecting: {0}", user);
                client.Disconnect ();

                Console.WriteLine ("Stopped client: {0}", user);
                client.Stop ();
            }