示例#1
0
        protected void Application_Start(object sender, EventArgs e)
        {
            Thread th = new Thread(new ThreadStart(serverd.Run));

            th.Start();
            populateLabs();
            ClientNodeList list = labListGlobal.getLabComputers("CG");
        }
示例#2
0
        public void addLab(String name)
        {
            mutex.AcquireWriterLock(60000);

            ClientNodeList tmp = new ClientNodeList(name);

            lab_list.Add(tmp);

            mutex.ReleaseLock();
        }
示例#3
0
        //this is what will happen in the thread
        private static void childFunc(Object o)
        {
            TcpClient clientSocket = (TcpClient)o;

            running = true;

            NetworkStream ns = clientSocket.GetStream();

            //get MAC address
            //stream_writer.WriteLine("getMAC");
            String command = "getMAC";

            WriteMessage(ns, command);
            String mac = ReadMessage(ns);

            String [] detail    = getLabDetail(mac);
            String    lab_name  = detail[0];
            String    comp_name = detail[1];

            /*
             * Add the client node to the list
             */
            ClientNodeList comp_list       = Global.labListGlobal.getLabComputers(lab_name);
            ClientNode     associated_node = null;

            associated_node = new ClientNode(comp_name, clientSocket, mac);
            comp_list.addClient(associated_node);

            /*
             * Loop until thread end
             */
            while (running)
            {
                /*
                 * If the ASP.NET thread wants an image, then fetch it
                 */
                if (associated_node.node_mode == 1)
                {
                    //expired image , request new
                    updateImageInNode(ns, associated_node);
                    //done with the job time to change node state
                    associated_node.node_mode = 0;
                }

                /*
                 * If ASP.NET thread wants process stats, then fetch those.
                 */
                if (associated_node.node_mode == 2)
                {
                    updateStatInNode(ns, associated_node);
                    //done with the job time to change node state
                    associated_node.node_mode = 0;
                }
            }
        }
示例#4
0
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList2.Items.Clear();

            /*
             * Populate the Computers
             */
            string labID = DropDownList1.SelectedItem.Value;

            if (labID == "-1")
            {
                Label1.Visible  = true;
                Button1.Enabled = false;
                return;
            }

            ClientNodeList computers = Global.labListGlobal.getLabComputers(labID);

            if (computers != null)
            {
                foreach (ClientNode node in computers.list)
                {
                    // TODO : MAC to be added to value
                    DropDownList2.Items.Add(new ListItem(node.name, node.mac.ToString()));
                }
                if (DropDownList2.Items.Count == 0)
                {
                    Label1.Visible    = true;
                    Button1.Enabled   = false;
                    Button1.BackColor = System.Drawing.Color.Gray;
                }
            }
            else
            {
                Label1.Visible    = true;
                Button1.Enabled   = false;
                Button1.BackColor = System.Drawing.Color.Gray;
            }
        }